First and Second Order Central Difference
이전 댓글 표시
The 1st order central difference (OCD) algorithm approximates the first derivative according to
,
and the 2nd order OCD algorithm approximates the second derivative according to
.
In both of these formulae
is the distance between neighbouring x values on the discretized domain.
a.
Write a script which takes the values of the function
for
and make use of the 1st and 2nd order algorithms to numerically find the values of
and
. You may use the analytical value of
to find initial condtions if required.
for
and make use of the 1st and 2nd order algorithms to numerically find the values of b.
Plot your results on two graphs over the range
, comparing the analytical and numerical values for each of the derivatives.
, comparing the analytical and numerical values for each of the derivatives. c.
Compare each numerical algorithms results by finding the largest value of the relative error between the analytical and numerical results.
Can someone please help with this question? I'm stuck on where to begin really. Thanks! This is what I have so far, but comes up with errors.
clear all
f=@(x) cosh(x)
x=linspace(-4,4,9)
n=length(x)
i=1:n
h=x(i)-x(i-1)
xCentral=x(2:end-1);
dFCentral=(F(i+1)-F(i))/(h);
채택된 답변
추가 답변 (1개)
Mk
2022년 11월 5일
0 개 추천
When Backward Difference Algorithm is applied on the following data points, the estimated value of Y at X=0.8 by degree one is_______ x=[0;0.250;0.500;0.750;1.000]; y=[0;6.24;7.75;4.85;0.0000];
a.
2.78
b.
3.78
c.
2.88
d.
3.88
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

