plot 2D graph
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Walter Roberson
el 29 de Jun. de 2019
It appears that you will need to work numerically, as the system is difficult to solve symbolically.
Respuestas (1)
Star Strider
el 29 de Jun. de 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 comentarios
Ver también
Categorías
Más información sobre Calculus en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!