How to plot implicit ODE?
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
0 投票
How can I plot the solution of this ODE x^2.y’-y-y^2=0. Help me out please, I am new at Matlab.
採用された回答
Davide Masiello
2022 年 9 月 27 日
編集済み: Davide Masiello
2022 年 9 月 27 日
You need to solve it first.
The ODE can be easily made explicit
Then you can use any Matlab ODE solver (see this documentation) to numerically solve it and then plot it using the plot function.
I suggest you give it a go, and if you stumble into problems of any sort maybe come back here and we can fix them.
8 件のコメント
Juan Vicente
2022 年 9 月 27 日
I try to do it using ode45, but I am not getting the graph

Davide Masiello
2022 年 9 月 27 日
編集済み: Davide Masiello
2022 年 10 月 21 日
First, add brackets to code the function correctly.
F = @(x,y) ((y^2+y)/x^2);
Second, the problem with you integration is that the first x value is 0.
Since x is at the denominator, this yields an array of NaN values
[x,y] = ode45(F,[0 5],0);
y
y = 41×1
0
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
If you start x from 1, for instance, you do get a plot.
[x,y] = ode45(F,[1 5],0);
plot(x,y)

The plot is flat because the initial value for y is also zero, which make its derivative zero too, as you can see from the ODE.
Still for the sake of example, assume that y0 = 0.1.
[x,y] = ode45(F,[1 5],0.1);
plot(x,y)

Juan Vicente
2022 年 9 月 27 日
I get it now, but using the subjected approach, how can I plot the solution?

Davide Masiello
2022 年 9 月 27 日
I am not sure what you mean by that, could you please clarify?
Juan Vicente
2022 年 9 月 27 日
I got a homework to do for extra points and it is to plot the solution of that ode, I want to know if there is a way to plot it using Matlab? I attached the original graph

Davide Masiello
2022 年 9 月 27 日
Well, if you have an analytical solution then you can just use that for plotting.
But that's a different problem, so you should change your question.
Juan Vicente
2022 年 9 月 27 日
Thanks for the advice, I’ll do that.
Torsten
2022 年 10 月 21 日
Solve the last equation for y and incorporate the boundary condition to get the constant C.
What's the problem ?
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Ordinary Differential Equations についてさらに検索
製品
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
