double.m

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

M
32
字号
function d=double(c);
% COMPONENTS/DOUBLE converts a Components object into a double matrix
% Usage:
%  d=double(c);
%
% Parameters:
%  c: the Components object to convert
%
% Note:
%  This function will give an 'hht:unequal' error if 'dt's are not equal.

% Kenneth C. Arnold <kca5@cornell.edu> 2004-07-30

% Ensure that 'dt's are the same for each component; otherwise, the
% component is not exactly representable within a double matrix.
dt = get(c,'dt');
nc = get(c,'nc');
for i=1:nc
    if get(c,'dt',i) ~= dt
        error('hht:unequal', 'delta-t unequal in Components object.');
    end
end

% preallocate matrix
d = zeros(get(c,'npts'),nc);
% store
for i=1:nc
    s = c.d(i).stime - c.stime;
    e = c.d(i).etime - c.stime;
    d(fix(s/dt)+1:fix(e/dt)+1,i) = c.d(i).c;
end

⌨️ 快捷键说明

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