Question: Every time I run this code I get this error message The Taylor polynomial is a powerful tool for approximation The Taylor polynomial of degree
The Taylor polynomial is a powerful tool for approximation The Taylor polynomial of degree n for ex, for any given x, is r" n! ending in x White a MATLAB function M-tle named TaylorPoly The first nput argument so t'he function shouild be The econd shod be the degree of the Taylor Polynomial,n. The output should be the approximalion of e*x Exampies TaylorPoy(1,3) ans - 26607 TayloPoly(1,10) n27183 Your Function 1 function ex TaylorPoly(x,n) 2 Xreplace the line below with your code to compute ex using n terms of the Taylor Polynomial 3%Define the function. 4 s if nume1(x) > 1 6 error ('Error using TaylorPoly Input must be scalar 7 elseif x>n 8 warning ('This is not a good approximation) g else 10 ex 1; 11 facti -1 12 for i-1:n 13 facti facti i; 14 ex ex+x (i)/facti; 15 end 16 end 17 end Code to call your function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
