6-1.m

来自「MATLAB的部分源代码,与MATLAB数字信号处理与应用一书相配套」· M 代码 · 共 23 行

M
23
字号
%例程6-1  计算非平稳随机信号的STFT时频谱
% e.g.6-1.m for example6-1;
% to test function spectrogram;
 
clear all;
t=0:1/1000:1.023;   % 1.023 second and 1kHz sample rate
 
% Generate two Chirp signals and added each other
x1=chirp(t,0,1,300,'q',[],'convex');   % starts at DC and crosses 300Hz at t = 1 sec. 
x2=chirp(t,300,1,0,'q',[],'convex');
x=x1+x2;
subplot(211);
plot(t,x);
title('Chirp signal x');
axis([0 1.05 -1 1]);
 
%Compute and display the PSD of each segment of a quadratic chirp
subplot(212);
spectrogram(x,256,200,256,1000,'yaxis')    %Spectrogram using short-time Fourier transform 
xlabel('Time(s)');
ylabel('Frequency (Hz)');
title('STFT of x');

⌨️ 快捷键说明

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