📄 polyfitxy.m
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -