How do I use quiver with an implicit differential equation?

4 views (last 30 days)
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)’

Answers (1)

esat gulhan
esat gulhan on 16 Sep 2020
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

Categories

Find more on Vector Fields in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!