how to create direction field for ode?
이전 댓글 표시
hi there
my equation is: x^2*(dy/dx)+ x*y =1;
i want to draw the direction field of first-order linear ODE
the code for direction field is:
------------------------------------
clear;
dist1=linspace(-10,10,80);
[x,y]=meshgrid(dist1);
dydx=((1-x.*y)./x^2);
v=sqrt(1+dydx^2);
quiver(x,y,1./v,dydx./v,'m');
result is dummy :

----------------------------------but when i solve the eqn :y= (log(x)+c1)./x
and with plot command i draw these graphs.
question:how coud i produce direction field which is compatible with graphs and where is the code mistake?
댓글 수: 1
Sai Ram Charan
2021년 2월 20일
Hope this helps
답변 (1개)
sam shafi
2021년 8월 23일
0 개 추천
syms y(t)
ode = diff(y)+4*y == exp(-t);
cond = y(0) == 1;
ySol(t) = dsolve(ode,cond)
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!