📄 6-1.m
字号:
%例程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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -