Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

3. The reciprocal of the exponential function can be approximated using the foll

ID: 669406 • Letter: 3

Question

3. The reciprocal of the exponential function can be approximated using the following approach e^ - x = ... Write a MATLAB code that uses this approach to evaluate e^ - 5. Compare your results to the true value with at least 6 significant figures. Starting with one term, evaluate the series and compute true and approximate relative errors as terms are added up to a total of 20 terms. The output should be a table that displays the number of terms used, the approximation to the function, the true relative error and approximate relative error, for each number of terms. Include a copy of the command window with all inputs and the output table in the word document.

Explanation / Answer

% Number of Terms
term = 20;

% power of e to be computed
X = 5;

% Final Result
res = 1;

% Computing Result
for i = 1:(term-1)
   if (i % 2 == 1)
       res = res - (power(X,i)/factorial(i));
   else
       res = res + (power(X,i)/factorial(i));
   end  
end
res

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote