声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1048|回复: 0

[综合] 求各位大神帮看下这段s逆变换matlab code !!!!

[复制链接]
发表于 2015-4-14 11:35 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
最近刚开始学习s变换,这是从网上下载的一段Stockwell写的逆变换matlab代码,里面注释较多,实际其实有10行左右。想请教各位大神为什么要分情况讨论有奇数个点和偶数个点?if rem(ntimes ,2) ~= 0 ?
非常感谢!



function [ts] = inverse_st(st)
% Returns the inverse of the Stockwell Transform of the REAL_VALUED timeseries.
% Code by Robert Glenn Stockwell.
% Reference is "Localization of the Complex Spectrum: The S Transform"
% from IEEE Transactions on Signal Processing, vol. 44., number 4, April 1996, pages 998-1001.
%
%-------Inputs Needed------------------------------------------------
%   
%  S-Transform matrix created by the st.m function
%-------Optional Inputs ------------------------------------------------
% none
%-------Outputs Returned------------------------------------------------
%
% ts     -a REAL-VALUED time series
%--------Additional details-----------------------
%   Copyright (c) by Bob Stockwell
%   $Revision: 1.0 $  $Date: 2004/10/10  $

% sum over time to create the FFT spectrum for the positive frequencies
stspe = sum(st,2);

% get st matrix dimensions  
[nfreq,ntimes] = size(st);
if rem(ntimes ,2) ~= 0
    % odd number of points, so nyquist point is not aliased, so concatenate
    % the reversed spectrum to create the negative frequencies
    % drop the DC value
    negspe = fliplr(stspe(2:nfreq)');
else
     % even number of points
     % therefore drop the first point (DC) and the last point (aliased nyqusit freq)
     negspe = fliplr(stspe(2:nfreq-1)');
end

% using symmetry of FFT spectrum of a real signal, recreate the negative frequencies from the positie frequencies
fullstspe = [conj(stspe')  negspe];     

% the time series is the inverse fft of this
ts = ifft(fullstspe);
% and take the real part, the imaginary part will be zero.
ts = real(ts);




回复
分享到:

使用道具 举报

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-6-12 09:36 , Processed in 0.048865 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表