Question: This is the matlab code I have so far: clc; clear; prompt_x = 'Please enter the value of x to calculate its exponential value:'; x

This is the matlab code I have so far:
clc; clear;
prompt_x = 'Please enter the value of x to calculate its exponential value:';
x = input(prompt_x);
n = 0;
er = 0;
a = x^n/factorial(n);
b = exp(x);
while er >= 0.01
a = a+(x^n/factorial(n));
n = n+1;
b = exp(x);
end
fprintf('The approximated exponential value is %d with %d terms.',a,n);
5. Using while loop write down a general matlab code to calculate e from the Taylor Series summation. n! Let the summation of Taylor Series to be a. Also let the exponential value using matlab function EXP(x) to be b. b exp (x) Then we define the error as: er Your code shall find the exponential using Taylor Series with an error er s 0.01. In other words the condition to terminate the while loop is not n iterations as we did in the class work but it is the error value to be less than 0.01. The output of the code will be a as well as n. Save your code as a script file named HW35 (120 minutes 18 points)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
