Question: % Set parameters x = 1 ; N = 5 ; % Task 5 b test 1 = my _ f 1 _ loops (

% Set parameters
x =1;
N =5;
% Task 5b
test1= my_f1_loops(x, N);
% Task 5c
test2= zeros(1,5);
for N =0:4
test2(N+1)= my_f1_loops(x, N);
end
% Task 5d
actualValue = exp(x);
absoluteError = abs(test2- actualValue);
% Plotting
figure;
bar(absoluteError);
title('Absolute Error Difference for e^x Approximations');
xlabel('N');
ylabel('Absolute Error');

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!