필터 지우기
필터 지우기

fsolve in backward euler method

조회 수: 2 (최근 30일)
Hrishikesh Das
Hrishikesh Das 2020년 4월 30일
편집: Hrishikesh Das 2020년 4월 30일
Please help to implement fsolve for a third order ODE
%%
clear
close all
clc
%%
%% The differential equation is : x''' = 2 x'' + 6x
%Boundary condition
%x(0) =1, x'(0) = 0, x''(0)=1,
% Changing a third order differential equation into a system of linear
% equation
%x(1) = x ;
%%x(2) = x' = x(1)'
%x(3) = x'' = x(2)'
%x(3)' = 2 x(3) + 6 x(1)
t0 = 0; %initial value
x0 = [1;0;1]; %initial condition(given)
tEnd = 5; %end of time step
h = 0.001; %step size
N = (tEnd-t0)/h; %number of interval
T = t0:h:tEnd;
X = zeros(3, N+1); %a series of 3-element column vectors
X(:,1) = x0;
for i = 1:N
%fi = [X(2,i);X(3,i);2*X(3,i)+6*X(1,i)];
x = fsolve(@(x) x-X(:,i) - h* %%%%%%%%%); <-- problem.
X(:, i+1) = x;
end
%%
%ploting===================================================================
plot(T,X,'.','LineWidth',2);
title('Approximate solution Euler Implicit Method')

답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by