필터 지우기
필터 지우기

how to plot a 123linear sweep spectrogram

조회 수: 1 (최근 30일)
ting po chun
ting po chun 2023년 6월 11일
댓글: ting po chun 2023년 6월 12일
Hi. I would like tp plot a linear sweep spectrogram and the frequency are 20Hz to 20kHz. Same of the fig. picture.
Thank!
  댓글 수: 3
Diwakar Diwakar
Diwakar Diwakar 2023년 6월 11일
May be this code will help you.
% Parameters
duration = 5; % Duration of the sweep in seconds
samplingRate = 44100; % Sampling rate in Hz
startFrequency = 20; % Start frequency in Hz
endFrequency = 20000; % End frequency in Hz
windowSize = 512; % Size of the analysis window
% Generate linear sweep signal
t = 0:1/samplingRate:duration; % Time vector
sweep = chirp(t, startFrequency, duration, endFrequency, 'linear');
% Compute spectrogram
overlap = round(windowSize*0.75); % Overlap between consecutive windows
nfft = 2^nextpow2(windowSize); % Number of FFT points
[s, f, t] = spectrogram(sweep, windowSize, overlap, nfft, samplingRate);
% Plot spectrogram
figure;
imagesc(t, f, 10*log10(abs(s)));
axis xy; % Flip the y-axis
colormap(jet);
colorbar;
xlabel('Time (s)');
ylabel('Frequency (Hz)');
title('Linear Sweep Spectrogram');
ting po chun
ting po chun 2023년 6월 12일
@diwakar diwakar Thank you very much.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by