Matlab 线性拟合 polyfit 结果不准/偏差很大

polyfit 结果不准

由于我的数据来源于实验,太大没法放在这里,直接放代码和图展示问题,记此笔记方便后续翻阅

[T30H_Lin, F30H_Lin] = SelectFitData(0.65,2.9,F30H, T30H);
[p,S,mu] = polyfit(T30H_Lin,F30H_Lin,1);  % 函数调用方式与下面有区别
T30H_Lin_Fit = T30H_Lin(1):0.1:20;
F30H_Lin_Fit = polyval(p,T30H_Lin_Fit);

plot(T30H_Lin_Fit, F30H_Lin_Fit)

Matlab 线性拟合 polyfit 结果不准/偏差很大_第1张图片

[T30H_Lin, F30H_Lin] = SelectFitData(0.65,2.9,F30H, T30H);
p = polyfit(T30H_Lin,F30H_Lin,1);
T30H_Lin_Fit = T30H_Lin(1):0.1:20;
F30H_Lin_Fit = polyval(p,T30H_Lin_Fit);

plot(T30H_Lin_Fit, F30H_Lin_Fit)

Matlab 线性拟合 polyfit 结果不准/偏差很大_第2张图片

结论

p = polyfit(T30H_Lin,F30H_Lin,1);
[p,S,mu] = polyfit(T30H_Lin,F30H_Lin,1);

这两种调用方式结果不一样,不应该认为返回值返回值越多越精确或者说返回值越多的肯定包含少的

你可能感兴趣的:(MATLAB)