ode45 function troubles
显示 更早的评论
So this is my function
function v = sdof(t, x)
k=1000;m=5;z=[0 0.1 0.25 0.5 0.75 0.9 1]; c=2*sqrt(k*m)*z;
v=[x(2); x(1).*-k/m+x(2).*-c/m];
and im calling it like this
ts=[0 5] ;
x0=[0.05;0];
[t,x]=ode45('sdof',ts, x0);
figure (1)
plot(t, x(:,1));
I am trying to solve the diffy q with the varying amount of zeta 'z' values. I can get this code to work fine with 1 z value but as soon as i add the array it gives me a bunch of errors. I tried using some type of loop but that didnt work either. Any idea on how to get that to work? Thank you!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB Mobile Fundamentals 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
