Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

solving ode without using ode solver

Status
Not open for further replies.

lolypop

Mechanical
Oct 3, 2007
4
is there any way to solve a second degree ordinary differential equation using matlab without using built-in ode solver such as ode45,ode23,rk4 etc?
 
Replies continue below

Recommended for you

because i would like to solve the problem using two methods and compared the results to check for their accuracies
 
The very name rk45 is because that method itself uses two different methods and compares them internally to determine a sense of the accuracy.

You can write you own method that does not replace all of the very difficult MATLAB functionality if you only want to test accuracy. Go ahead an write you own integrator and set the step size low and look for convergenceon a particular problem. Then check the MATLAB ones.
 
your equation may have an analytical solution obtainable through the symbolic toolbox (dsolve command).

There are many many numerical methods you can program (although I agree you will have to do a lot of work to get nearly as accurate/efficient as ode45b). The simplest (but not most accurate) is to set up the problem the same as you would for ode45: dx/xt = f(x,t) where x is a state vector. Then start with an initial condition x0. Then time step
x1 = x0 + delta-t * f(x0,t0)
x2 = x1 + delta-t * f(x1,t1)
etc

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor