Solve equation of motion using ode45!
1 次查看(过去 30 天)
显示 更早的评论
Hi, I am trying to solve an equation of motion using ode45. I saw others work, and how they implement the method, however, I did not get a reasonable answer. It seems so simple, but I do not know why I got such weird answers! Could anyone help me figure it out? My code is as follows:
main body:
t=0:.02:5;
X=[.002 ; 0];
[t,y]=ode45(@YP,t, X);
figure(1)
plot(t,y(1), '+')
figure(2)
plot(t,y(2), 'o')
Function:
function ydot= YP(t,x)
m=2459;k=107.178;zeta=.005;
wn=sqrt(k/m);
c=zeta*(2*m*wn);
ydot=[x(2);(-1/m)*(c*x(2)+k*x(1))];
2 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!