How do I use quiver with an implicit differential equation?

4 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Vector Fields 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by