forward, backward, center approximations for f(x) = e^x-2x+1

how toget starded

1 Comment

I suggest getting started by googling the formulas for forward, backwards, and center approximations.

Sign in to comment.

Answers (1)

Hint:
for K = 1 : numel(y);
xdiff(K) = x(K+2) - x(K+1);
end
for K = 1 : numel(y)
yleading(K) = y(K);
end
for K = 3 : numel(y)
ytrailing(K-2) = y(K);
end
for K = 1 : numel(yleading)
ydiff = ytrailing(K) - yleading(K);
end
for K = 1 : numel(ydiff)
centerdiff(K) = ydiff(K) ./ xdiff(K);
end
Note that there are deliberate bugs in this code... besides it being written in just about the most inefficient way possible.

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Tags

Asked:

on 10 Apr 2025

Answered:

on 10 Apr 2025

Community Treasure Hunt

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

Start Hunting!