Direction field and slope field- quiver

34 ビュー (過去 30 日間)
Anand Ra
Anand Ra 2021 年 11 月 26 日
コメント済み: Anand Ra 2021 年 11 月 30 日
Looking for some help to generate slope field for the below differential equation
% dN/dt = (b − a ln(N))N
[N,t]=meshgrid(0:1:6,0:1:10);
%Case 1: b<a
b=10;
a=20;
dN=(b - a.*log(N)).*N;
dt=1;
dNu=dN./sqrt(dN.^2+dt.^2);
dtu=dt./sqrt(dN.^2+dt.^2);
quiver(N,t,dtu,dNu)
Note sure how to fix the above. Any help would be appreictaed. Thank you.
  2 件のコメント
Shivam Singh
Shivam Singh 2021 年 11 月 29 日
Hello Anand,
In the differential equation provided, dr/dt = (b − a ln(N))N, what is the "N"? Is it a variable different from "r" or the same?
Anand Ra
Anand Ra 2021 年 11 月 29 日
Hello Shivam, thanks for responding.
Its suppose to be N ( r=N). My bad, sorry for the typo.

サインインしてコメントする。

回答 (1 件)

Shivam Singh
Shivam Singh 2021 年 11 月 29 日
Hello Anand,
“quiver (X, Y, U, V)” plots arrows with directional components U and V at the Cartesian coordinates specified by X and Y. So, if you have a function Z = f(X, Y) with two independent variables X and Y, then you need two directional components, U and V as U = dZ/dX and V = dZ/dY to create a slope plot or direction plot.
Currently your code has only one independent variable 't' and a single directional component dN/dt.
For more information, you can explore “quiver” function.
  1 件のコメント
Anand Ra
Anand Ra 2021 年 11 月 30 日
Thank you @Shivam Singh

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeVector Fields についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by