cos taylor matlab,Taylor Series

Taylor Series

The statements

syms x

f = 1/(5 + 4*cos(x));

T = taylor(f, 'Order', 8)

return

T =

(49*x^6)/131220 + (5*x^4)/1458 + (2*x^2)/81 + 1/9

which is all the terms up to, but not including, order eight in the Taylor series for

f(x):

∑n=0∞(x−a)nf(n)(a)n!.

Technically, T is a Maclaurin series, since its expansion point is a = 0.

These commands

syms x

g = exp(x*sin(x));

t = taylor(g, 'ExpansionPoint', 2, 'Order', 12);

generate the first 12 nonzero terms of the Taylor series for g about

x = 2.

t is a large expression; enter

size(char(t))

ans =

1 99791

to find that t has about 100,000 characters in its printed form. In

order to proceed with using t, first simplify its presentation:

t = simplify(t);

size(char(t))

ans =

1 6988

Next, plot these functions together to see how well this Taylor approximation compares to

the actual function g:

xd = 1:0.05:3;

yd = subs(g,x,xd);

fplot(t, [1, 3])

hold on

plot(xd, yd, 'r-.')

title('Taylor approximation vs. actual function')

legend('Taylor','Function')

9c09c9c4bfba3a2a37c58163393bd47d.png

Special thanks is given to Professor Gunnar Bäckstrøm of UMEA in Sweden for this

example.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值