Doubt regarding ode45 plotting

4 ビュー (過去 30 日間)
Pavan Kumar
Pavan Kumar 2015 年 1 月 27 日
編集済み: Pavan Kumar 2015 年 2 月 3 日
Dear Friends,
I need to plot ABS(B(1)) Vs delk in the following program code. How can i include delk variable in the ode45 function calling line.

採用された回答

Torsten
Torsten 2015 年 1 月 28 日
Please make more clear what you try to plot.
As far as I can see, delk is a model parameter (scalar).
B is a vector (solution at different times).
You can't plot a vector over a scalar.
I guess you want to plot different solutions B over time for different values of delk.
For this puropse, you have to generate different solutions B (e.g. in a loop in which you call ODE45 several times for changing values of delk).
Best wishes
Torsten.
  9 件のコメント
Pavan Kumar
Pavan Kumar 2015 年 1 月 29 日
Thanks a lot..Will try it and come back to you
Pavan Kumar
Pavan Kumar 2015 年 2 月 2 日
Hii Torsten,
your advise really helped. Thanks a trillion bro...
Pavan

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

その他の回答 (1 件)

Sara
Sara 2015 年 1 月 27 日
ode45(@(t,x)DFG789(t,x,var_1),.....
Then the function becomes:
function dB = DFG789(Z1,B,var_1)
  1 件のコメント
Pavan Kumar
Pavan Kumar 2015 年 1 月 28 日
編集済み: Pavan Kumar 2015 年 1 月 28 日
Hii Sara, Thanks for the advise.
I made the following changes
[Z1,B] = ode45(@(t,x)DFG789(t,x,delk),[0 3],[(0.1) 0 1],delk); and
function dB = DFG789(Z1,B,delk)
However, when i try to execute
plot(delk,abs(B(:,1)).^2);
i get the following errors. What can i do?

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

カテゴリ

Help Center および File ExchangeFunction Creation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by