plot 2D graph

8 visualizaciones (últimos 30 días)
Mahshid khatami
Mahshid khatami el 29 de Jun. de 2019
Respondida: Star Strider el 29 de Jun. de 2019
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
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.

Iniciar sesión para comentar.

Respuestas (1)

Star Strider
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.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by