How to plot ODE function and I don't get this plot.

1 回表示 (過去 30 日間)
Myo Gyi
Myo Gyi 2018 年 9 月 28 日
コメント済み: Rena Berman 2018 年 10 月 4 日
  1 件のコメント
Rena Berman
Rena Berman 2018 年 10 月 4 日
(Answers dev) Restored edit.

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

採用された回答

Torsten
Torsten 2018 年 9 月 28 日
Solve the ODEs using ODE45, e.g., and use "plot3" for the plot.
Best wishes
Torsten.
  2 件のコメント
Torsten
Torsten 2018 年 9 月 28 日
function main
%Set initial values for r, theta, z
r00 = 10;
theta00 = 0;
z00 = 1.0;
y0 = [r00 theta00 z00];
% Set model parameters
z0 = 0.0;
a = 0.1;
gamma_inf = 1000.0;
nu = 1.0;
% Set integration period
tspan = 0:0.05:10;
% Call integrator
fun = @(t,y)[-a*y(1);gamma_inf/(2*pi*y(1)^2)*(1-exp(-a*y(1)^2/(2*nu)));2*a*(y(3)-z0)];
[T Y] = ode45(fun,tspan,y0)
R = Y(:,1);
THETA = Y(:,2);
Z = Y(:,3);
% Convert polar to cartesian coordinates
[x y] = pol2cart(THETA,R)
% Plot spiral
plot3(x,y,Z)
Myo Gyi
Myo Gyi 2018 年 9 月 28 日
Thank you very much sir..... You are very kind and helpful.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by