Writing a matlab script to approximate exp(x)

Assignment Help MATLAB Programming
Reference no: EM13168343

writing a matlab script to approximate exp(x) at exp(.05) using ""Taylor series"" ""and"" a ""while loop"".

a=.05 is very close to a convenient x value. The allowable error (error = |guess-true|) is to be less than or equal to 10^-9.

I also need to figure out how many terms in the Taylor series were required to achieve convergence. Plot the n=1, n=2, n=3 approximations to e^x for x=0:0.05:1, and plot the built-in exp(x) function on this same interval. Ensure that each line has a unique LineSpec format (ie- line style, tickmark, color), and provide a legend identifying your four curves. Label x and y axes as "Domain" and "Range".

 

This is what I have so far. How do I add the 3 n values. I JUST NEED TO ADD THE N-1, N-2, N-3 But I don't know how.

 

clear, clc

err = 1;

order = 1;

while err > 0.000000001

syms x;

approx = taylor(exp(x),x,'Order',order);

 

x = 0.05;

 

approx = eval(approx);

err = abs(exp(0.05) - approx);

order = order + 1

end

 

 

Reference no: EM13168343

Questions Cloud

Show work on the mineral greenockite is yellow sulfide : show work on the mineral greenockite is yellow sulfide of cadmium that is 78.0% cadmium and 22.0% sulfur. determine the empirical formula of greenockite.
Problems of an aging society : Discuss the impact of the problems of an aging society on our country.
What is this freezing point on the kelvin scale : A thermometer indicates that water freezes at 0.5 degrees Celsius and boils at 100.2 degrees Celsius at a barometric pressure of 760 torr. The observed freezing point of an unknown liquid is -1.3 degrees Celsius.
Swot analysis results of the new ict service : Compare the SWOT Analysis results of the current ICT service with the SWOT Analysis results of the new ICT service.
Writing a matlab script to approximate exp(x) : writing a matlab script to approximate exp(x) at exp(.05) using ""Taylor series"" ""and"" a ""while loop"".
Person lives in urban poverty : If a person lives in urban poverty, how can s/he find a job when there are few jobs available in the inner cities, little transportation to the suburbs, and when they have no skills because of poorly funded public schools?
What is the molecular formula of the compound : a certain anesthetic contains 64.9 percent C, 13.5 percent H, and 21.6 percent O by mass. at 120 grades celcius and 750 mmHg, 1.00 L of the gaseous compound weighs 2.30g. What is the molecular formula of the compound?
Write a program that will read in 2 test score. : Write a program that will read in 2 test score. The instructor has decided to give each student 10 bonus point on each test. Print out each test score and the total after the bonus, the print the total number of points earned on the tests.
Deliver the speech with confidence : Ensure that the language is used correctly.  Speaker credibility influences how listeners feel about the speaker.  Character is the quality of being honest, trustworthy, and showing goodwill.  Deliver the speech with confidence.

Reviews

Write a Review

MATLAB Programming Questions & Answers

  Computes the stiffness matrix for one bilinear element with

write Matlab code that computes the stiffness matrix for one bilinear element with 4 nodes

  Travelling salesman problem involves

The Travelling Salesman problem involves a salesman who has to visit a number of cities in a single closed tour. The salesman always starts and ends the tour in his home city and visits each other city on the tour exactly once.

  Write a script to solve the following systems of equations

Write a script to solve the following systems of equations using both matrix left division (\) and the inverse matrix method and Show that you have tested your MATLAB code appropriately

  Find the integral of a function at an arbitrary location

Write a Matlab function to perform numerical integration of a set of evenly spaced data points using the trapezoidal rule

  Write matlab scripts

Write MATLAB scripts for to accept two numbers from the user; Display all prime numbers between these two numbers.

  Determine the stability status for the digital system

Sketch the z-plane pole-zero plot and determine the stability status for the following digital system.

  Write a matlab function that takes in one argument

Write a MatLab function that takes in one argument, a vector or 2-D matrix and returns a single value, the highest value in the vector or matrix. Use nested for loops to accomplish this task. Assume that all of the values in the vector or matrix are ..

  Design simple interface hardware

Evaluate the capability in selecting and configuring a microcontroller unit designing simple interface hardware and writing subroutines to operate those interfaces

  Calculate and plot the error in the numerical derivative

Write a program to calculate and plot the error in the numerical estimate of the derivative.

  Matlab program which will determine your vehicle fuel usage

Create a MATLAB program which will determine your vehicle fuel usage (MPG, miles/gallon) rating for a user defined number of trips ('for' repetition structure).

  First ten numbers of the sequence of pseudorandom numbers

write a program that gives the first ten numbers of the sequence of pseudorandom numbers

  Create the graph using matlab functions

Create the graph, which contains a piecewise function where a line exists in the first interval, a parabola in the second interval, and the sine function in the third interval.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd