📄 hilberte.m
字号:
function z=hilberte(x)
% z=hilberte(x): Hilbert transform with endpoint adjustment
% Input:
% x: input data
% Output:
% z: Hilbert transformed output data
%% just do hilbert now, to make it work.
%z=hilbt(x);
[n,k]=size(x);
for c=1:k
cx = x(:,c);
% -- predict before real data --
i=2;
n_mx=-1; n_mn=-1;
firstExtremum=0;
while i<=n-1 & (n_mx < 0 | n_mn < 0)
prev=cx(i-1);
cur=cx(i);
next=cx(i+1);
if (prev<cur)&(cur>=next) % max point
n_mx=i;
if ~firstExtremum
firstExtremum=i;
end
elseif (prev>=cur)&(cur<next) % min point
n_mn=i;
if ~firstExtremum
firstExtremum=i;
end
end
i=i+1;
end
if i==n
nPredictHead = 0;
else
flipped=0;
if n_mn>n_mx % flip so that "max" > "min"
tmp=n_mx;
n_mx=n_mn;
m_mn=tmp;
flipped=1;
end
% get known half-period
hp=cx(n_mn:n_mx); % half-period
hpLen = n_mx-n_mn+1;
if flipped
hp = flipud(hp); % so half-period is always increasing
end
hpDeriv = diff(hp);
% find where we are at the end in derivative terms
endDeriv = cx(2)-cx(1);
% find this derivative within the half-period
if endDeriv<min(hpDeriv)
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -