2nd Order Nonlinear Differential Equation Solving with Central Difference Method?

5 ビュー (過去 30 日間)
Furkan Celik
Furkan Celik 2019 年 3 月 1 日
コメント済み: Torsten 2021 年 7 月 17 日
I am trying to solve a 2nd order non linear differential equation using central finite difference method but ı cant, it is a boundary value problem
y''+2y'+5y=8sinx+4cosx
y(0)=0 and y(30)=0
step is dx=0.5
How can ı solve it, would you give me some suggestion about that or any script ?

回答 (3 件)

Torsten
Torsten 2019 年 3 月 1 日
http://web.mit.edu/10.001/Web/Course_Notes/Differential_Equations_Notes/node9.html

Furkan Celik
Furkan Celik 2019 年 3 月 3 日
編集済み: Furkan Celik 2019 年 3 月 3 日
Thank you so much for your response.. Im sharing script what i did.
clear all;
clc;
x = 0:3:30;
n = length(x);
y = zeros(1,n);
y(1,1)=0;
y(1,n)=0;
A = zeros(n-2);
B = zeros(1,n-2);
for i=1:n-2;
A(i,i) = 43;
end
for i=2:n-2;
A(i,i-1)=-2;
A(i-1,i)=4;
end
A
B(1,1)= 9*(8*sind(x(1,2))+4*cosd(x(1,2)));
B(1,n-2) = 9*(8*sind(x(1,n-1))+4*cosd(x(1,n-1)))
for i=2:n-3;
B(1,i)=9*(8*sind(x(1,i+1))+4*cosd(x(1,i+1)));
end
B
BB=B';
Y = inv(A)*BB;
YY=Y'
y(1,2:n-1)=YY(1,1:n-2)
plot(x,y);
  2 件のコメント
TRUONG HONG
TRUONG HONG 2021 年 7 月 17 日
Can i ask a question?
how can you find A(i,i) A(i,i-1) and A(i-1,1)
Thank u
Torsten
Torsten 2021 年 7 月 17 日
All explained on the above website.

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


Thanawut Sumtib
Thanawut Sumtib 2021 年 4 月 5 日
Use the finite difference method to solve y'' + 2 y' 3 y = 0 from t = 0 to 4 using a step size of 1 with y(0) = 1 and y’(0)=1.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by