polyfitxy.m
来自「fit programme for a serials of data」· M 代码 · 共 16 行
M
16 行
function A=polyfitxy(x,y,m)
%input x is a 1*N vector
% y is a 1*N vector
% m is the degree of the polynomial to be obtain
%output A is the coeficient of the polynomial
n=length(x);
f=zeros(n,m+1);
%fill the columns of f with the powers of x
for i=1:m+1
f(:,i)=x.^(i-1);
end
%solve the linear system to obtain the coeficient of polynomial
B=f'*f;
C=f'*y';
A=B\C;
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?