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!