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

  Describe how you would access these 4 members

Create a namespace titled global Type that contains four members. The members should be two named constants, n and rate. It should also contain a variable count and the function printResult. Describe how you would access these 4 members in a progr..

  Explore the design of a recursive digital filter

In this simulation we are going to explore the design of a recursive digital filter which might be usedvin a digital radio station. The sampling frequency used in digital radio (DAB) is either 48 kHz or 24 kHz and for the purposes of this simulation,

  Program should be able to handle collisions

Write a program that, given a list of 5 social security numbers, finds the memory locations assigned by the hashing function h(k) = k mod 55 to store customer records. program should be able to handle collisions.

  Division by zero is not possible

You must also ensure that division by zero is not possible. If the user tries to divide by zero, the calculation should not be attempted, and an error message should appear in the Result text box.

  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.

  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 ..

  Compute and flote 4 average temperature profiles

Generate by measdata.m an array A withsize (365,24), containing temperature measurements for an entire year [1 January,..., 31 December], 24 hours a day [00.00h,...,23.00h].

  Create a function that returns true i

Create a function that returns true if the input is a numeric matrix and false otherwise.

  Write a matlab function that takes a matrix

Write a MATLAB function that takes a matrix, a row number and a column number. Beginning with the row number passed to the function, scan down the column passed to the function and return the row number that contains the largest absolute value in ..

  Write a function named ''read_line''

Verify that your code works by saving some text into a file (created in notepad / textedit) and saving the file with extension '.txt'. You should attach the file (call it 'test.txt') with your code.

  Fit the exponential function to the relaxation data

Fit the exponential function to the relaxation data and report the filename as well as the A, tau and B values and run all 3 functions in sequence to analyze ALL data

  One-dimensional steady-state heat flow

A one-dimensional steady-state heat flow, the mathematical formulation of problem - find out the temperature differences at each locations and calculate the temperatures at each locations

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