Placement 2025 Scholarship: Your Future Starts Here | 6 Guaranteed Job Interviews | 1̶0̶0̶ 29 seats only. Apply Now

00D 00H 00M 00S

Menu

Executive Programs

Workshops

Projects

Blogs

Careers

Placements

Student Reviews


For Business


More

Academic Training

Informative Articles

Find Jobs

We are Hiring!


All Courses

Choose a category

Mechanical

Electrical

Civil

Computer Science

Electronics

Offline Program

All Courses

All Courses

logo

CHOOSE A CATEGORY

Mechanical

Electrical

Civil

Computer Science

Electronics

Offline Program

Top Job Leading Courses

Automotive

CFD

FEA

Design

MBD

Med Tech

Courses by Software

Design

Solver

Automation

Vehicle Dynamics

CFD Solver

Preprocessor

Courses by Semester

First Year

Second Year

Third Year

Fourth Year

Courses by Domain

Automotive

CFD

Design

FEA

Tool-focused Courses

Design

Solver

Automation

Preprocessor

CFD Solver

Vehicle Dynamics

Machine learning

Machine Learning and AI

POPULAR COURSES

coursePost Graduate Program in Hybrid Electric Vehicle Design and Analysis
coursePost Graduate Program in Computational Fluid Dynamics
coursePost Graduate Program in CAD
coursePost Graduate Program in CAE
coursePost Graduate Program in Manufacturing Design
coursePost Graduate Program in Computational Design and Pre-processing
coursePost Graduate Program in Complete Passenger Car Design & Product Development
Executive Programs
Workshops
For Business

Success Stories

Placements

Student Reviews

More

Projects

Blogs

Academic Training

Find Jobs

Informative Articles

We're Hiring!

phone+91 9342691281Log in
share

Share

Mechanical

Modified on

07 Jul 2023 08:22 pm

How Ode45 Takes the Pain Out of Solving Higher Order Derivatives

logo

Skill-Lync

Introduction to ODE45

ODE45 is a standard MATLAB solver used to solve first-order ordinary differential equations. The function ODE45 implements a Runge-Kutta method with a variable time step for its computation.

ODE45 can compute an ODE of the form,

where t is the independent variable, y is a vector of dependent variables to be found, and f (t, y) is a function of t and y. The function f (t, y) is set, and the initial condition which is the value of the function at t=0s. i.e.  y = y0 at time t0 are given.

Syntax for ODE45

The function ode45 takes 3 inputs. The 3 inputs are the function to be integrated, the time span and the initial conditions.

The time span would be the integration limits. This can be provided as a vector of 2 values, the initial and final time or with a spacing using the linspace function. The solver will choose a step size that is most suitable for the solution to obtain the solution in the most optimal time as possible. The initial condition would be the value of the function at t=0s. 

The function can be provided in the form of an anonymous function, 

[t,results] = ode45(@(x) x^2, tspan,y0)

Here, we are saying that we don’t know the value of x and that x is an input to the anonymous function that we have defined here. This is equivalent to defining a function that takes the input of x and gives the output of x^2. 

The function can also be defined as a separate function. This function must take at least 2 inputs, which should be t and y, apart from other arguments, where t would be the current time and y would be the value of the function at the previous time step. 

Assuming we have a function ode, the function must be defined as, 

function [output] = ode(t,y,args) 

where args refer to any other arguments that the function may take. 

This function must then be input to ode45 as 

[t,results] = ode45(@(t,y) ode(t,y,args), tspan, y0)

This is necessary to tell the function which arguments of the function are to be found by the solver.

Ode45 for higher-order derivatives

How Ode45 takes the initial conditions.

Let us take an example of 3rd-order ODE.

For 3rd order derivative we have 3 initial conditions which can be initialized in an array as follows.

At time t=0  ,   [I.C- 1, 1.C- 2, I.C-3]  (I.C=Initial condition)

Lets us consider the example given below.

Initial conditions given at t =0 for  `y` ,`dy/dt` and `(d^2y)/(dt^2)`

We can initialize the initial condition as an array as follows.

[5  -9    16]

How ODE45 communicates

For a higher order derivative we need to reduce it into various first order differential equation. For example a 3rd order ODE must be split  into three 1st order ODE.

Basically, you could have an ODE of any arbitrary order. What is important is that you reduce them to multiple 1st order ode's. Ode45 stores the results as state vectors, so if Y is the solution array, it will store the values as follows,

The above higher order derivatives can be represented as multiple 1st order derivatives in terms of state vectors i.e.

The results for Y will be stored as state vectors as shown above. y1,y2,y3,y4…yn are called the state variables.

So any higher order differential equation can be represented as a state vector.

So in our given example,

We can represent the above equation in terms of state vector. So this can done as follows:

How to write an external function for the above example

 Assuming we have a function ode the above example, the function can be defined as, 

 function [Ydot] = odefun(t,y) 

Ydot=zeros(3,1)

Ydot(1)=y(2)

Ydot(2)=y(3)

Ydot(3)=3*y(2)-4*y(3)

end

Finally, the function can be called in main program as:

Ode45(‘Odefun’, tspan, I.C)


Author

author

Navin Baskar


Author

blogdetails

Skill-Lync

Subscribe to Our Free Newsletter

img

Continue Reading

Related Blogs

Shock tube simulation

Learn how to render a shock-tube-simulation and how to work on similar projects after enrolling into anyone of Skill-Lync's CAE courses.

Mechanical

10 May 2020


Design of Frontal BIW enclosure of a car (Bonnet)

In this blog, read how to design the frontal BIW enclosure of a car (Bonnet) and learn how Skill-Lync Master's Program in Automotive Design using CATIA V5 will help you get employed as a design engineer.

Mechanical

10 May 2020


What is Tetra Meshing?

Tetrahedral is a four- nodded solid element that can be generated through the tria element by creating a volume and also through the existing volume of the geometry. These elements are used where the geometry has high thickness and complexity. The image attached below is a representation of a Tetra element. The Tetra element will have 4 triangular faces with four nodes joining them together

Mechanical

02 Aug 2022


Realizing Connectors In HyperMesh

A connector is a mechanism that specifies how an object (vertex, edge, or face) is connected to another object or the ground. By often simulating the desired behaviour without having to build the precise shape or specify contact circumstances, connectors make modeling simpler.

Mechanical

03 Aug 2022


Mesh Sizing In Ansys Workbench

One of the most crucial processes in carrying out an accurate simulation using FEA is meshing. A mesh is composed of elements that have nodes—coordinate positions in space that might change depending on the element type—that symbolise the geometry's shape.

Mechanical

04 Aug 2022



Author

blogdetails

Skill-Lync

Subscribe to Our Free Newsletter

img

Continue Reading

Related Blogs

Shock tube simulation

Learn how to render a shock-tube-simulation and how to work on similar projects after enrolling into anyone of Skill-Lync's CAE courses.

Mechanical

10 May 2020


Design of Frontal BIW enclosure of a car (Bonnet)

In this blog, read how to design the frontal BIW enclosure of a car (Bonnet) and learn how Skill-Lync Master's Program in Automotive Design using CATIA V5 will help you get employed as a design engineer.

Mechanical

10 May 2020


What is Tetra Meshing?

Tetrahedral is a four- nodded solid element that can be generated through the tria element by creating a volume and also through the existing volume of the geometry. These elements are used where the geometry has high thickness and complexity. The image attached below is a representation of a Tetra element. The Tetra element will have 4 triangular faces with four nodes joining them together

Mechanical

02 Aug 2022


Realizing Connectors In HyperMesh

A connector is a mechanism that specifies how an object (vertex, edge, or face) is connected to another object or the ground. By often simulating the desired behaviour without having to build the precise shape or specify contact circumstances, connectors make modeling simpler.

Mechanical

03 Aug 2022


Mesh Sizing In Ansys Workbench

One of the most crucial processes in carrying out an accurate simulation using FEA is meshing. A mesh is composed of elements that have nodes—coordinate positions in space that might change depending on the element type—that symbolise the geometry's shape.

Mechanical

04 Aug 2022


Book a Free Demo, now!
Know more about our Engineering courses with Job Assistance!

Related Courses

https://d28ljev2bhqcfz.cloudfront.net/maincourse/thumb/combustion-cfd-specialisation_1636553169.png
Combustion CFD Specialist
4.8
35 Hours of content
Cfd Domain
Know more
https://d28ljev2bhqcfz.cloudfront.net/maincourse/thumb/introduction-cfd-matlab-openfoam_1636552778.jpg
Introduction to CFD using MATLAB and OpenFOAM
4.8
13 Hours of content
Cfd Domain
Know more
https://d28ljev2bhqcfz.cloudfront.net/maincourse/thumb/masters-cfd_1636550988.jpg
Post Graduate Program in Computational Fluid Dynamics
4.8
125 Hours of content
Cfd Domain
Know more
logo

Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.

https://d27yxarlh48w6q.cloudfront.net/web/v1/images/facebook.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/insta.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/twitter.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/youtube.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/linkedin.svg

Our Company

News & EventsBlogCareersGrievance RedressalSkill-Lync ReviewsTermsPrivacy PolicyBecome an Affiliate
map
EpowerX Learning Technologies Pvt Ltd.
4th Floor, BLOCK-B, Velachery - Tambaram Main Rd, Ram Nagar South, Madipakkam, Chennai, Tamil Nadu 600042.
mail
info@skill-lync.com
mail
ITgrievance@skill-lync.com

Top Individual Courses

Computational Combustion Using Python and CanteraIntroduction to Physical Modeling using SimscapeIntroduction to Structural Analysis using ANSYS WorkbenchIntroduction to Structural Analysis using ANSYS Workbench

Top PG Programs

Post Graduate Program in Hybrid Electric Vehicle Design and AnalysisPost Graduate Program in Computational Fluid DynamicsPost Graduate Program in CADPost Graduate Program in Electric Vehicle Design & Development

Skill-Lync Plus

Executive Program in Electric Vehicle Embedded SoftwareExecutive Program in Electric Vehicle DesignExecutive Program in Cybersecurity

Trending Blogs

Heat Transfer Principles in Energy-Efficient Refrigerators and Air Conditioners Advanced Modeling and Result Visualization in Simscape Exploring Simulink and Library Browser in Simscape Advanced Simulink Tools and Libraries in SimscapeExploring Simulink Basics in Simscape

© 2025 Skill-Lync Inc. All Rights Reserved.

              Get Free Access to Resume-Building Resources.