Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Power Of Numbers In Health Care A Students Journey In Data Analysis

Authors: Kaiden

1st Edition

8119747887, 978-8119747887

More Books

Students also viewed these Databases questions