Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

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

image text in transcribed

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

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

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students explore these related Databases questions

Question

8. Explain the contact hypothesis.

Answered: 3 weeks ago

Question

2. Define the grand narrative.

Answered: 3 weeks ago