How do I use quiver with an implicit differential equation?

21 ビュー (過去 30 日間)
Ramadan M
Ramadan M 2020 年 9 月 15 日
回答済み: esat gulhan 2020 年 9 月 16 日
I have pasted the full question below for context, but essentially, I'm having issues ironing out how quiver works for part a. I tried to mimic the example in the textbook, but it returns multiple errors, and I've checked the documentation for quiver, which hasn't helped.
syms y(t)
[T, Y] = meshgrid(-10:0.2:10, -1:0.2:2); %unsure what the bounds should be???
S = (2*y - t)/(2*t - y); %equation
quiver(T, Y, ones(size(S)), S), axis equal tight
xlabel ’t’, ylabel ’y’
title ’Direction Field for dy/dt = (2*y - t)/(2*t - y)’

回答 (1 件)

esat gulhan
esat gulhan 2020 年 9 月 16 日
Maybe like this
syms S C c t y
[T, Y] =meshgrid(-10:0.5:10,-10:0.5:10);
S= ((2.*Y-T)./(2.*T-Y))
dT = ones(size(S)); %equation
dyu = S./sqrt(dT.^2+S.^2);
dxu = dT./sqrt(dT.^2+S.^2);
quiver(T,Y,dxu,dyu)
xlabel ’t’, ylabel ’y’
title('Direction Field for dy/dt = (2*y - t)/(2*t - y)')
set(gca, 'XLim', [0 10], 'YLim', [0 10]);
It is not an easy ODE, There is singularity in some fields. Can not be reached with dsolve, can be reach numerically ODE solvers

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by