ex6_6.m
来自「Advanced Engineering Mathematics using M」· M 代码 · 共 14 行
M
14 行
% EX6_6.M Taylor series example% Calculate error in Taylor series expansion (6 terms) of exp(x)format longx=1.0yexact=exp(1)nfact=5*4*3*2*1;yseries=1+x+(x^2)/2+(x^3)/(3*2)+(x^4)/(4*3*2) +(x^5)/(nfact)fprintf('Error in 6 term Taylor series for exp(1) \n')yerror=abs(yexact-yseries)errbound=yexact*(1/(6*nfact))%% Modify the script to allow input of variable x and the % number of terms in the series. Then, test the error as% a function of x and n. Try the symbolic command taylor
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?