フィルターのクリア

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 Center および File ExchangeCalculus についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by