繁体   English   中英

在matlab中计算S变换及其平方值

[英]compute S transform and its square value in matlab

让我们考虑以下代码

http://www.mathworks.com/matlabcentral/fileexchange/45848-stockwell-transform--s-transform-/content/stran.m

计算S变换,这是我的代码

function ST=stran(h)
% Compute S-Transform without for loops
%%% Coded by Kalyan S. Dash %%%
%%% IIT Bhubaneswar, India %%%
[~,N]=size(h); % h is a 1xN one-dimensional series
nhaf=fix(N/2);
odvn=1;
if nhaf*2==N;
    odvn=0;
end
f=[0:nhaf -nhaf+1-odvn:-1]/N;
Hft=fft(h);
%Compute all frequency domain Gaussians as one matrix
invfk=[1./f(2:nhaf+1)]';
W=2*pi*repmat(f,nhaf,1).*repmat(invfk,1,N);
G=exp((-W.^2)/2); %Gaussian in freq domain
% End of frequency domain Gaussian computation
% Compute Toeplitz matrix with the shifted fft(h)
HW=toeplitz(Hft(1:nhaf+1)',Hft);
% Exclude the first row, corresponding to zero frequency
HW=[HW(2:nhaf+1,:)];
% Compute Stockwell Transform
ST=ifft(HW.*G,[],2); %Compute voice
%Add the zero freq row
st0=mean(h)*ones(1,N);

ST=[st0;ST];

end

并考虑跟随线性调频信号

>> t = 0:0.001:2;
x = chirp(t,100,1,200,'quadratic');

我需要确认我在做正确的事情

>> ST=stran(x);
>> plot(abs(ST))

图片在这里 在此处输入图片说明

发表我的评论作为答案:

我对s变换不太了解,但AFAIK的结果是3D信号(如您在ST的大小中可以清楚看到的),因此您可能要进行图像imagesc(abs(ST))surf(abs(ST),'linestyle','none')而不是图。

在您的图中,您绘制了1000条线,这就是为什么它如此混乱的原因。

运用

imagesc(abs(ST)) 在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM