Clear Filters
Clear Filters

How to change frequency range doubling of Complex-valued Chirp Signal Spectrogram to match the Real-Valued Chirp Spectrogram

3 views (last 30 days)
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 ')

Accepted Answer

Paul
Paul on 2 May 2024
Edited: Paul on 2 May 2024
No, it appears there's no way to change that if you want to have spectrogram make the plot.
Can use ylim to alter the plot after the fact.
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
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.
Taehwan Kim
Taehwan Kim on 2 May 2024
Paul, Thanks! The 'centered' option solved two problems that I questioned to my satisfaction. First, it limited the complex chirp frequency range doubling that ylim could be also used. Second, it also limited the frequency shifting of conjugated or reversed complex chirp when 'centered' option was not entered.

Sign in to comment.

More Answers (0)

Categories

Find more on Time-Frequency Analysis in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!