?? tfar.m
字號:
function specs=tfar(sig, order,long,shift,fmin,fmax,fs)
% time-freq analysis using AR spectra
% specs=tfar(sig, order,long,shift,fmin,fmax,fs)
% 'sig' is analyzed in blocks of size 'long'
% with consecutive blocks offset by amount 'shift'
% spectra are calculated for 100 points between fmin and fmax
%
% This program is distributed as a supplement to the book
% "Biomedical Signal Processing and Signal Modeling" by E. N. Bruce,
% published by Wiley, 2000. It is provided for educational use only.
% While every effort has been made to insure its suitability to illustrate
% principles described in the above book, no specific feature or capability
% is implied or guaranteed.
ns=fix((length(sig)-long)/shift)
specs=zeros(100,ns+1);
w=2*pi*linspace(fmin/fs,fmax/fs);
for j=1:ns
inx=(j-1)*shift+1;
th=ar(detrend(sig(inx:(inx+long))),order,'fb','ppw');
sptemp=th2ff(th,0,w);
specs(:,j)=sptemp(2:101,2);
end
specs(:,j+1)=linspace(fmin,fmax)';
timeindx=[0:shift:shift*(ns-1)]/fs;
figure(1)
mesh(timeindx,linspace(fmin,fmax),specs(:,1:ns));view(120,60);grid;
title('Time-frequency spectral plot')
xlabel('Time (sec)');ylabel('Frequency (Hz)')
figure(2)
contour(timeindx,linspace(fmin,fmax),specs(:,1:ns));grid;
title('Contours of time-frequency spectral plot')
xlabel('Time (sec)');ylabel('Frequency (Hz)')
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -