st_inverse_test.m

来自「s变换」· M 代码 · 共 70 行

M
70
字号
% the s-tranform test script
len = 127;
freq = 5;   
t = 0:len-1;

% CREATE the chirp example
chirp = cos(2*pi*(10+t/7).*t/len);
% add a single peak in the spectrum
chirp = chirp + cos(2*pi*(10).*t/len);



[st_matrix_chirp,st_times,st_frequencies] = st(chirp);


% subplot(2,1,1);
% plot(chirp);
% subplot(2,1,2);
% contourf(st_times,st_frequencies,abs(st_matrix_chirp));


% calculate the spectrum for comparison
spe = fft(chirp);
posspe = spe(1:65);


% calculate the inverse ST
% step one: collapse over time to create the complex valued spectrum
st = st_matrix_chirp;

[ts] = inverse_st(st);


 
% plot out stuff
nrows = 6;
subplot(nrows,1,1);
plot(chirp);
title('chirp');


subplot(nrows,1,2);
plot(angle(spe));
title('full fft spe');

subplot(nrows,1,3);
plot(angle(fullstspe));
title('st  full spe');


subplot(nrows,1,4);
plot(abs(spe - fullstspe));
title('abs of difference');


subplot(nrows,1,5);
plot(ts);
title('inverse ST time series');

subplot(nrows,1,6);
plot(ts - chirp);
title('difference between chirp and inverse ST time series (< 10-15 in magnitude)');







⌨️ 快捷键说明

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