plot 2D graph

8 ビュー (過去 30 日間)
Mahshid khatami
Mahshid khatami 2019 年 6 月 29 日
回答済み: Star Strider 2019 年 6 月 29 日
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 件のコメント
Walter Roberson
Walter Roberson 2019 年 6 月 29 日
It appears that you will need to work numerically, as the system is difficult to solve symbolically.

サインインしてコメントする。

回答 (1 件)

Star Strider
Star Strider 2019 年 6 月 29 日
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.

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by