t=[0:54];y=[1.4712 1.45327 1.44467 1.42513 1.41487 1.40393 1.382667 1.3706 1.35807 1.34513 1.33187 1.3186 1.3048 1.29107 1.27733 1.2637 1.25007 1.2366 1.2311 1.2179 1.2049 1.19226 1.17993 1.175 1.1631 1.15167 1.14727 1.13633 1.125733 1.12193 1.11187 1.108533 1.099 1.0898 1.08693 1.078267 1.0758 1.0676 1.06547 1.0591 1.05586 1.0486 1.04707 1.0402 1.03893 1.03253 1.03153 1.02553 1.0248 1.019267 1.0188 1.013733 1.0134 1.01367 1.0088];plot(t,y,'o');p=polyfit(t,y,2)
这是我编的程序,但是只能看见离散的图,我想知道添加什么才能使得拟合的曲线也显示在离散图里面。谢谢了~!急需要知道!
t=[0:54];
y=[1.4712 1.45327 1.44467 1.42513 1.41487 1.40393 1.382667 1.3706 1.35807 1.34513 1.33187 1.3186 1.3048 1.29107 1.27733 1.2637 1.25007 1.2366 1.2311 1.2179 1.2049 1.19226 1.17993 1.175 1.1631 1.15167 1.14727 1.13633 1.125733 1.12193 1.11187 1.108533 1.099 1.0898 1.08693 1.078267 1.0758 1.0676 1.06547 1.0591 1.05586 1.0486 1.04707 1.0402 1.03893 1.03253 1.03153 1.02553 1.0248 1.019267 1.0188 1.013733 1.0134 1.01367 1.0088];
plot(t,y,'o');
hold on
p=polyfit(t,y,2)
y1=polyval(p,t);
plot(t,y1)