least.m

来自「hilbert-huang 变换的源码 蛮有用的」· M 代码 · 共 31 行

M
31
字号
function [cof1,cof2]=least(x,dt)

% The function LEAST returns the coefficients found by least square method.
% Only 1st column of 2-D input data x(:,1) is processed.
%
% Calling sequence-
% [cof1,cof2]=least(x,dt)
%
% Input-
%	x		- 2-D data x(m,n)
%	dt		- the true delta t
% Output-
%	cof1,cof2	- numbers representing the coefficients 
%
% Used by-
% 	ACC2DIS

%----- Get dimensions
[m,n]=size(x) ;

%----- Calculate the coefficients
sx=sum(x(:,1))	;
sxx=0.	;
for jj=1:m	;
   sxx=sxx+jj*x(jj,1) ;
end
   cof1=(2*(2*m+1)*sx-6*sxx)/(m*(m-1))  ;
   cof2=(12*sxx-6*(m+1)*sx)/(dt*m*(m-1)*(m+1)) ;
   
   
   

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?