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

3 次查看(过去 30 天)
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 ')

采纳的回答

Paul
Paul 2024-5-2
编辑:Paul 2024-5-2
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 个评论
Paul
Paul 2024-5-2
"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 2024-5-2
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Time-Frequency Analysis 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by