calcyclic.m

来自「对信号进行短时傅立叶变换」· M 代码 · 共 45 行

M
45
字号
function scf=calcyclic(tfr);
% calculate the scf of the signal by time-frequence expression
%
% tfr is a matrix of [f,t]

[xrow,xcol]=size(tfr);

scf=zeros(xrow,xcol);
X=zeros(1,xrow);
X1=zeros(1,xrow);
X2=zeros(1,xrow);

%for cyclic frequence loop
for a=1:xrow
    %for time loop
    %let X = 0
    X=zeros(1,xrow);

    %set X1 and X2 move length
    a1=floor(a/2);
    if a/2==.5,
        a2=a1+1;
    else
        a2=a1;
    end

    for i=1:xcol
        X1=[tfr((xrow-a1+1):xrow,i)' tfr(1:(xrow-a1),i)'];
        X2=[tfr((a2+1):xrow,i)' tfr(1:a2,i)'];
        X=X+(X1).*conj((X2));
    end

    if a==64
        %plot(1:512,X1);
        %figure;
        %plot(1:512,X2);
        %figure;
        %plot(1:512,X);
        b=a;
    end    
    %sum up the short time frequence
    scf(:,a+1)=X'./xcol;
end

end

⌨️ 快捷键说明

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