필터 지우기
필터 지우기

Trying to make an Adams-Bashforth method with Richardson error estimate

조회 수: 1 (최근 30일)
ce
ce 2022년 12월 10일
편집: Mayank Sengar 2023년 1월 12일
%This program solves the initial value problem
% y' = f(x,y), x0 <= x<= b, y(x0)=y0
%Initializing vaiables
%f'(x,y)=
f = @(x,y) cos(y).^2; %derivative in question
g = @(x) atan(x); %this is the actual solution
x0 = 0; %initial value of x
x_end = 10; %end of approximation
h = 0.1; %size of decimal place (0.1,0.001,etc
y0=0; %initial value of y
n = fix((x_end-x0)/h)+1;
x = linspace(x0,x_end,n);
y = zeros(n,1);
y(1) = y0;
f1 = f(x(1),y(1));
y(2) = y(1)+h*f1;
%need to add error
for i = 3:n
f2 = f(x(i-1),y(i-1));
y(i) = y(i-1)+h*(3*f2-f1)/2;
f1 = f2;
fprintf('%5.4f %11.8f\n', x(i), y(i));
plot(x(i),y(i),'b.'); grid on;
fplot(g,[x0,x_end]);
xlabel('x values'); ylabel('y values');
hold on;
end
I'm not sure how I would add the Richardson error to this code. I see the formula in my textbook, but don't understand how I would make it work. . Like I don't really know what that means. I understand the AB method for solving DefEqs, but not ther errors
  댓글 수: 1
Torsten
Torsten 2022년 12월 10일
편집: Torsten 2022년 12월 10일
I'm confident that after reading this article
you will know how Richardson extrapolation works.

댓글을 달려면 로그인하십시오.

답변 (1개)

Mayank Sengar
Mayank Sengar 2023년 1월 12일
편집: Mayank Sengar 2023년 1월 12일

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by