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),

1 view (last 30 days)
%HOW DO I ADD THE THREE N APPROXIMATIONS TO THIS CODE?
clear,
clc
err = 1;
order(1) = 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
order

Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!