Question: Instructions: 1 . Create using MATLAB 2 . Use the following program: C l C clear Approximate the value of e ? ? x using

Instructions:
1. Create using MATLAB
2. Use the following program:
ClC
clear
Approximate the value of e??x using the Taylor Series
x= input( 'Enter the value of x for e???x.,x=') ;
t= input ( Enter the amount of desired terms. ,t=1);
i=1;
e_taylor =0; % initializing the variable for the accumulator
while it
e_taylor = e_taylor +x???i-1? factorial (i-1);
i=i+1;,20 change the value of variable i
end
real_value =exp(x);
disp('Real Value' )
disp(real_value)
disp('Approximated value with Taylor series')
disp (e_taylor)
disp('amount of iterations')
disp(i)
disp('real error')
E= abs (e_taylor - real_value);
disp(E)
3. Modify the program to do:
a. The program calculates the actual value with the Matlab exp(x) command.
b. Change the while cycle for a for-loop command from 1 to imax iteration.
c. Declare an imax variable equal to 100 to assign the maximum iteration.
d. Add before the for loop a line with: real = exp (x);
e. Assign the value of 0.0001 to a tolerance variable. If you want to challenge yourself, create a menu to select the tolerance value with different values.
f. Add within the loop algorithm and if abs (e_taylor - real)= tolerance, then break.
4. Create the flowchart of the program.
 Instructions: 1. Create using MATLAB 2. Use the following program: ClC

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!