Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create MATLAB / Scilab code that calculates e^x using the following formula, and

ID: 1716137 • Letter: C

Question

Create MATLAB / Scilab code that calculates e^x using the following formula, and measure the absolute error from the MATLAB / Scilab provided function.

Please submit Your MATLAB / 1. 2. Copy of a screenshot after your program is executed. Create MATLAB/ Scilab code that calculates e x using the following formula, and measure the absolute error from the MATLAB / Scilab provided function. The Taylor series for the exponential function e O0 72 26 24 120 n! Plot both (1) the approximated value, and (2) absolute error

Explanation / Answer

clc

clear all

x=input('enter x value ');

a=exp(x);

Ts=1+x+(x^2/2)++(x^3/6)+(x^4/24)+(x^5/120);

absoluteerror=(a-Ts)/a

RESULT:

enter x value
3

absoluteerror =

0.0839