How to change frequency range doubling of Complex-valued Chirp Signal Spectrogram to match the Real-Valued Chirp Spectrogram
11 views (last 30 days)
Show older comments
When real-valued linear chirp is plotted in spectrogram, the frequency range is limited to the Nyquist rate frequency range.
However, when complex-valued linar chirp with the same parameters is plotted, the frequency range of the spectrogram doubles. Is there an option to limit the frequeny range to the Nyquist rate?
%%%% Sample Code %%%%
Fs=2E3; %sampling rate
f0=0; %initial frequency offset = 0
f1=0.5E3; %LFM sweeping frequency
t1=0.5;
t=0:1/Fs:t1;
%
%Real Valued Chirp
%
yr=chirp(t,f0,t1,f1,'real');
figure
spectrogram(yr,[],256,512,Fs,'yaxis');
title('UP Chirp-Real in Time-Freq ')
%
%Complex Valued Chirp
%
yc=chirp(t,f0,t1,f1,'complex');
figure
spectrogram(yc,[],256,512,Fs,'yaxis');
title('UP Chirp-Complex in Time-Freq ')
0 Comments
Accepted Answer
Paul
on 2 May 2024
Edited: Paul
on 2 May 2024
Fs=2E3; %sampling rate
f0=0; %initial frequency offset = 0
f1=0.5E3; %LFM sweeping frequency
t1=0.5;
t=0:1/Fs:t1;
%
%Real Valued Chirp
%
yr=chirp(t,f0,t1,f1,'real');
figure
spectrogram(yr,[],256,512,Fs,'yaxis');
title('UP Chirp-Real in Time-Freq ')
%
%Complex Valued Chirp
%
yc=chirp(t,f0,t1,f1,'complex');
figure
spectrogram(yc,[],256,512,Fs,'yaxis');
title('UP Chirp-Complex in Time-Freq ')
ylim([0 1])
Or return the output arguments from spectrogram and then make the plot over whatever frequency range is desired.
But keep in mind that for complex signals the fully frequency range is typically required, i.e., there is no symmetry in the frequency domain as there would be for a real-valued signal.
4 Comments
Paul
on 2 May 2024
"The ylim command did not work,"
ylim worked exactly as advertised. It limited the range of the y-axis to be between 0 and 1 (kHz, which is Fs/2), just like spectrogram did itself for the real input.
According to spectrogram, the default freqrange for a real signal is 'onesided', which is what we see above, i.e., the frequency range goes from 0 -> Fs/2. But, becasuse the spectrum of a complex signal is not symmetric, the default freqrange for a complex signal is 'twosided', i.e., the frequency range covers 0 -> Fs. Or we can specify 'centered' to have the frequency range cover -Fs/2 -> Fs/2. According to that doc page, specifying 'onesided' as the freqrange for a complex input signal results in an error, which is why ylim is needed if you really want to limit the plot for the complex input to 0 -> Fs/2.
More Answers (0)
See Also
Categories
Find more on Time-Frequency Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!