clear;clc;
syms x a;
m=5;%自己改
y=(11/6-3*x+3/2*x^2-1/3*x^3)^a
f=taylor(y,m+1,x);
w=sym(zeros(m+1,1));
w(1)=subs(f,x,0);
f=f-w(1);
for n=m:-1:2
w(n+1)=subs(f-subs(f,x^n,0),x^n,1);
f=f-w(n+1)*x^n;
end
w(2)=subs(f,x,1)
注意,因为matlab数组下标从1开始,因此我这里w(1)是常数项,w(2)是一次项,以此类推,即
y=w(1)+w(2)*x+w(3)*x^2+....+w(m+1)*x^m
syms x a;
b=sym(zeros(1,100));
for n=1:100
b(n)=taylor((11/6-3*x+3/2*x^2-1/3*x^3)^a,n,x) ;
end