⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 f_specgram.asv

📁 digital signal processing常用工具箱
💻 ASV
字号:
function [G,f,t] = f_specgram (x,L,fs,win)
%-------------------------------------------------------------------
% Usage:       [G,f,t] = f_specgram (x,L,fs,win)
%
% Description: Compute the spectrogram of the signal x(k)
%
% Entry:       x   = vector of length N samples
%              L   = subsequence length
%              fs  = sampling freqeuncy
%              win = window type (0 to 4, see Table 3.8.1 of text)
%
% Exit:        G = (2M-1) by L matrix containing spectrogram
%              f = vector of length L/2 containing frequency values
%              t = vector of length 2M-1 containting time values
%-------------------------------------------------------------------

% Initialize

N = length(x);
f = linspace (0,(L-1)*fs/L,L);
T = 1/fs;
M = floor(N/L);
t = linspace (0,(2*M-2)*L*T/2,2*M-1);
G = zeros(2*M-1,L);
xm = zeros(1,L);

% Compute spectrogram

w = f_window (win,L); 
w(L+1) = [];                       
h = waitbar (0,'Computing Spectrogram');
for m = 1 : 2*M-1
    waitbar (m/(2*M-1),h)
    k = 1 + (m-1)*L/2;
    xm = x(k : k+L-1);
    G(m,:) = abs(fft(w .* xm));
end
close (h);
%-------------------------------------------------------------------

⌨️ 快捷键说明

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