How do I use quiver with an implicit differential equation?

조회 수: 4 (최근 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 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