plot 2D graph
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi , I have 2 below Eq. :
diff(V,t) = V-V.^3/3-U+2;
diff(U,t) = 1.25*(V-U+0.9);
I want to plot U'-V' plot. I don't know how to do this.
can anybidy help me please.
thanks
1 commentaire
Walter Roberson
le 29 Juin 2019
It appears that you will need to work numerically, as the system is difficult to solve symbolically.
Réponses (1)
Star Strider
le 29 Juin 2019
Try this:
syms t U(t) V(t) Y
Eqs = [diff(V,t) == V-V.^3/3-U+2; diff(U,t) == 1.25*(V-U+0.9)];
[VF,Sbs] = odeToVectorField(Eqs);
UVfcn = matlabFunction(VF, 'Vars',{t,Y});
Sbsc = sprintfc('%s',Sbs);
ic = [0; 0];
tv = linspace(0, 10, 5000);
[ts,UVs] = ode45(UVfcn, tv, ic);
figure
plot(ts, UVs)
grid
figure
plot(UVs(:,1), UVs(:,2))
grid
xlabel(Sbsc(1))
ylabel(Sbsc(2))
for k = 1:numel(ts)
dUV(:,k) = UVfcn(ts(k),UVs(k,:)); % Calculate Derivatives
end
figure
plot(dUV(:,1), dUV(:,2))
grid
lblf = @(x) sprintf('$\\frac{d%s}{dt}$',x);
xlabel(lblf(Sbsc{1}), 'Interpreter','latex')
ylabel(lblf(Sbsc{2}), 'Interpreter','latex')
I will let you explore it to discover how it works.
0 commentaires
Voir également
Catégories
En savoir plus sur Calculus dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!