필터 지우기
필터 지우기

Backward Euler with LU Decomposition

조회 수: 4 (최근 30일)
Vince Smith
Vince Smith 2019년 6월 2일
The code below solves forward Euler for a pendelum problem. How would I modify this code to solve with backward Euler and LU Decomposition?
length= 5;
g=9.8 ;
npoints = 5000;
dt = 0.01;
omega = zeros(npoints,1);
theta = zeros(npoints,1);
time = zeros(npoints,1);
theta(1)=0.5;
for step = 1:npoints-1
omega(step+1) = omega(step) - (g/length)*theta(step)*dt;
theta(step+1) = theta(step)+omega(step)*dt;
time(step+1) = time(step) + dt;
end
forward=[theta(end);omega(end)];

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Decomposition에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by