Solving second order differential equation using euler forward algorithm

2 ビュー (過去 30 日間)
Md Rubel Ahmed
Md Rubel Ahmed 2016 年 6 月 28 日
コメント済み: John D'Errico 2016 年 6 月 28 日
i need to solve a second order differential equation with writing loop by using euler forward algorithm.i listed my parameter as follows L=62.5e-3; R=200e-3; C=6.25e-6; V_s=60; initial condition : x1(0)=0; x2(0)=0;
now i define my equation as follows x1'=x2; x2'=(1/LC)*V_s-(R/L)*x2- (1/LC) x1; output: y=x1 In the following part i have to program the Euler's method to solve this problem and plot with respect to time and output y. defined some parameter for euler algorithm:
Tsim = 5; % simulate over Tsim seconds h = 0.01; % step size N= Tsim/h; % number of steps to simulation x(1)= 0 ; x(2)= 0; Simulation loop using Euler method for k=1:N How can i apply loop and get the plot from this ?
Input: model function x' = f(x) , simulation step size h, number of steps N to simulate, initial state x(1) Algorithm: for k from 1 to N, x(k+1) = x(k) + h*f(x(k)) end Output: sequence of simulated states x(1), x(2), …, x(N+1). output,y=x1
kindly can anybody help me ?i am new here.
  1 件のコメント
John D'Errico
John D'Errico 2016 年 6 月 28 日
It would help if you posted code that was actually readable.
Learn to use the "{} Code" button. Select a block of code when you paste it in. Then click on the "{} Code" button to format it as such.

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

回答 (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