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 CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by