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