Using matlab create program to show the following -Display the amount of terms u
ID: 3541871 • Letter: U
Question
Using matlab create program to show the following
-Display the amount of terms used.
-Display value of e^1
-Display relative approximate error of less than 10^-9 instead of 10^-6
Explanation / Answer
z = 10^(-9);
estimate = 0;
term = 1;
x = 1;
n = 1;
while exp(x)-estimate>z;
estimate = estimate+term;
term = term*x/n;
n = n+1;
end
fprintf(' No. of terms used = %d ',n);
fprintf(' value of e^1 = %f ',exp(x));
fprintf(' relative approximate ');
error = (exp(x)-estimate)/estimate
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.