how can I get a y value for a chosen x value.

5 ビュー (過去 30 日間)
Vanessa Chimedza
Vanessa Chimedza 2021 年 5 月 4 日
編集済み: Vanessa Chimedza 2021 年 5 月 5 日
I solved 5 ODEs which follow the the change of y with respect to time (t).This resulted in the the matrix [t,y] .The maximum value of t is 4.
I want to get the values of y for all the 5 equations at t=4.I have used the following code for getting the value of y but it is displaying the y value for the first equation only.
index=find(t==4);
yDesired=y(index);
How do I edit the code to display the values of y for all the 5 equations ?

採用された回答

Jan
Jan 2021 年 5 月 4 日
yDesired=y(index, :);
% ^
But this gives you the trajectory and all but the last derivative. To get "all equations" it is the easiest solution to call the function to be integrated:
[last_t, last_y] = YourODE(t(end), y(end, :))
  1 件のコメント
Vanessa Chimedza
Vanessa Chimedza 2021 年 5 月 4 日
Thank you .It worked!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by