how to make a function of this system
Afficher commentaires plus anciens
how do I make a function of this ?
Réponses (1)
syms a b y1(t) y2(t)
ode(1,1) = diff(y1,t,2) == a*y2 - cos(diff(y1,t));
ode(2,1) = diff(y2,t) == b*y1 + cos(t)
[V,S] = odeToVectorField(ode)
odeFun = matlabFunction(V,'vars',{'t','Y','a','b'})
tspan = [0 1];
yInit = [5 0 1];
a = 1;
b = 2;
[t,y] = ode45(@(t,Y)odeFun(t,Y,a,b), tspan, yInit);
plot(t,y)
5 commentaires
Jens Petit-jean
le 16 Mai 2021
Stephan
le 16 Mai 2021
Yes, what are the desired in- & outputs?
Jens Petit-jean
le 16 Mai 2021
Jens Petit-jean
le 16 Mai 2021
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



