func13.m
来自「数值分析最常用的四十种算法」· M 代码 · 共 14 行
M
14 行
%func13
%polynomial Fitting,the residue analysis willbe show at the end
x=linspace(1,8,8)
y=[15.3,20.5,27.4,36.6,49.1,65.6,87.8,117.6];
y = log(y);
[p,S] = polyfit(x,y,1)
f = polyval(p,x);
y=exp(y)
f=exp(f)
plot(x,y,'o',x,f,'-')
disp(abs(norm(y,inf)-norm(f,inf)))
%b=0.29121601623819 a=2.43685970632819
%the residure is (defined by infinite norm on those vector) :0.0824
%can also see the figure
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?