Matlab实现Taylor展开近似计算、五角星画法
x=1:0.01:2;
m=length(x);
s=ones(1,m).*x;
term=ones(1,m).*x;
n=1;
while max(abs(term))>eps
n=n+1;
term=(-1).*(x/(2*n-1)).*(x/(2*n-2)).*term;
s=s+term;
end
plot(x,s,'r');
hold on;
plot(x,sin(x),'--')
输出结果:
theta=(pi/10:4*pi/5:41*pi/10);
z=e.
原创
2020-07-11 13:27:36 ·
2157 阅读 ·
1 评论