clc;
clear;
Ls = 32768;
% yang ben shu
fs = 1024;
% cai yang pin lv
t0 = 0: 1/fs : (Ls-1)/fs;
t1 = t0(length(t0));
f0 = 100;
% qi shi pin lv
f1 = 400;
% zhong zhi pin lv
x = 1 * chirp(t0, f0, t1, f1) + 0 * chirp(t0, f1 + f0, t1, f1 + f1);
% yi bei pin xin hao
subplot(3, 1, 1);
plot(t0, x);
fftPoints = Ls;
ff = fft(x, fftPoints);
fre = ((1 : 1 : fftPoints) - 1) * fs / fftPoints;
amp = abs(ff) / (fftPoints / 2);
subplot(3, 1, 2);
plot(fre(1:fftPoints/2), amp(1:fftPoints/2));
subplot(3, 1, 3);
spectrogram(x, 128, 64, 128, fs);
扫频
最新推荐文章于 2024-04-30 20:44:34 发布