syms X Y;
xj=-5:0.01:5;
yj=1./(1+25*xj.*xj);
subplot(2,2,3);plot(xj,yj,'b');
xlabel('x','color','g');
ylabel('y','color','g');
title('Accuracy');
hold on
for i=2:10;
x=-5:(10.0./i):5;
y=1./(1+25*x.*x);
p=polyfit(x,y,i);
for j=1:(i+1)
Y=0;
Y=Y+p(j)*X.^(i-j+1);
Y=vpa(Y)
subplot(2,2,4);plot(xj,double(Y));
hold on
end
xlabel('x','color','g');
ylabel('y','color','g');
title('Least square method');
end
Y =
-0.03993610223642172523961661341853*X^2
錯(cuò)誤使用 symengine (line 58)
DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use VPA.
出錯(cuò) sym/double (line 523)
Xstr = mupadmex('symobj::double', S.s, 0); |