ODE45, use ode45 iteratively
Show older comments
Hi, I have the equation m.(xdbldot)+c.(xdot)+k.x = A.w^2; for which obtained the solution through ODE45 using state space form; function ydot=diffeqn(t,y) w=50;m=2;k=500;d=16; ydot(1)=y(2); ydot(2)=-d/m*y(2)-k/m*y(1)+A*w^2; ydot=ydot(:);
followed by
tspan=0:0.001:5;
[t,y]=ode45(@diffeqn,tspan,[0 0]);
yy1=y(:,1);
yy2=y(:,2);
acc=diff(yy2/(t(2)-t(1)));
Now i try to solve the ode for different values of the right side variable 'w'. I tried to use functions,but as ODE45 is inbuilt source code, i could not edit it. Is there any other means of doing it. note: I have also tried Rungekutta 4th order code without using ode45, yet ode45 seems to give finer results.
Thanks, Shravan.
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!