20251117
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
x=1:10;
|
||||
y=[4.9,3.3,4.2,4.2,5.7,6.5,7.7,9.4,14.7,19.0];
|
||||
a=polyfit(x,y,2);
|
||||
b=polyfit(x,y,3);
|
||||
c=polyfit(x,y,4);
|
||||
xx=1:0.1:10;
|
||||
yy1=polyval(a,xx);
|
||||
yy2=polyval(b,xx);
|
||||
yy3=polyval(c,xx);
|
||||
plot(x,y,'*b')
|
||||
hold on
|
||||
plot(xx,yy1,'-r',xx,yy2,'-g',xx,yy3,'-y')
|
||||
title('2,3,4次曲线拟合')
|
||||
xlabel('变量x')
|
||||
ylabel('变量y')
|
||||
legend('y','yy1','yy2','yy3')
|
||||
Reference in New Issue
Block a user