ode45 function troubles
Mostra commenti meno recenti
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!
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su MATLAB Mobile Fundamentals in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
