splinenormalize.m

来自「一种新的时频分析方法的matlab源程序。」· M 代码 · 共 44 行

M
44
字号
function [n,a]=splinenormalize(c)
% COMPONENTS/SPLINENORMALIZE Normalize a Components structure by spline envelope.
% Usage:
%  [n,a]=splinenormalize(c);
%
% Input:
%  c - Components object to be normalized
% Output:
%  n - Components object holding normalized data
%  a - Components object holding the corresponding splined envelope
%
% Used by-
%	FA
 
% Kenneth C. Arnold <kca5@cornell.edu>, 2004-07-30

% Allocate new structures (we will overwrite them later)
n = c;
a = c;

%----- Process each component
for i=1:get(c,'nc')
    npts = max(size(c.d(i).c));
    
    %----- Extract the extrema and their coordinates
    [mx, tx]=emax(abs(c.d(i).c));
    
    %----- Fix the end to prevent wide swaying in spline 
    %----- by assigning the te(1) and te(n) 
    %----- the same values as the first and last tx and mx.
    nExtrema=length(mx);
    if nExtrema > 1
        tx=[1;tx;npts];
        %----- Fix the ends at the same as the next point
        mx=[mx(1);mx;mx(end)];
        a.d(i).c = spline(tx,mx,(1:npts)');
        %----- Normalize the data by splined envelope
        n.d(i).c = c.d(i).c ./ a.d(i).c;
    else
        %----- Leave data unchanged
        a.d(i).c=ones(npts,1);
    end
end

⌨️ 快捷键说明

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