フィルターのクリア

How do I use finite difference scheme?

2 ビュー (過去 30 日間)
hyeonwoo park
hyeonwoo park 2018 年 5 月 1 日
回答済み: Rajesh Balagam 2018 年 5 月 3 日
1st order linear ODE over a range -2.0<x<2.0
y'+2xy=0
Requirement: Use a finite difference scheme with 1st order approximation of the derivative. And use 'for' function.
Task 1 : Draw solution curves with a symbol for dx=0.1 over the same range of x.
Task 2 : Repeat the same for dx=0.01 and draw on the same figure using a different symbol.
I don't know how to make this ODE solution without 'dsolve' function.
x1 = -1.9; y1 = 80*exp(-x1.^2);
for x2 = x1:0.1:1.9
y2 = y1-2.*x1.*y1.*(x2-x1)
end
plot (x2, y2, '-green')
  1 件のコメント
Torsten
Torsten 2018 年 5 月 2 日
Google "MATLAB & Euler method".

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

回答 (1 件)

Rajesh Balagam
Rajesh Balagam 2018 年 5 月 3 日

カテゴリ

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