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

  Finite difference method

Use the finite difference method to calculate the temperature at the point specified since it is easier.

  Determine the necessary shell temperature

In a shell-and-tube heat exchanger, one fluid passes through a central tube while another fluid flows through an outer shell in the opposite direction. The purpose is to heat the fluid passing through the central tube.

  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

  Compute the speed of single-stage planetary gear train

Write a MATLAB function [speed] = planetary (N, emesh, first, last, arm) that computes the speed of a given link in a single-stage planetary gear train.

  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.

  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.

  Develop a simulation program

Develop a simulation program

  Create a vector in matlab

Create a three dimensional diagram of function.

  Open a named pipe and to read data from the pipe

Open a named pipe and to read data from the pipe in matlab

  Write the commands that will create the matrix

Write the commands that will create the matrix.

  Lagrange interpolating polynomial of degree

Lagrange interpolating polynomial of degree

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