ODE45, use ode45 iteratively
显示 更早的评论
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.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!