Why will be obtained FWHM in the frequency domain twice the value expected?

Hi everyone .I wrote a code in MATLAB. In section 2, the FWHM value is almost twice the value I expected. Where is the problem? run order: 1.section 1 2.simulink 3.section 2

5 Kommentare

First guess might be you didn't divide by two to set Fmax???
What's the code you used to define the frequency?
Hello I defined the fft code as follows:
Signal_I= I_signal.data;
Signal_Q =Q_signal.data;
n2 = length(Signal_I);
fs2 = 12774e4;
f2 = (0:n2-1)*(fs2/n2);
Signal_fft =fft(Signal_I + 1i*Signal_Q);
plot(f2,real(Signal_fft));
figure
Y2=abs(fftshift(Signal_fft));
fshift2 = (-n2/2:n2/2-1)*(fs2/n2);
plot(fshift2,Y2);
grid
findpeaks( Y2, fshift2, 'Annotate', 'extents')
[pks,locs,w,p] = findpeaks(Y2, fshift2, 'MinPeakProminence',0.01)
title('Lorentzian (real part)')
xlabel('Frequency(Hz)')
True FWHM = 318.3
FWHM received from code= 583.7544 and 602.3741
Should I divide fs2 by 2? If yes, why? Please explain the reason Thank you
Looks like it to me,yes...why? Because the Nyquist frequency is
Fmax = Fs/2;
when you compute the FFT, the associated frequency goes from -Fmax : +Fmax; the two-sided FFT, where as above Fmax is 1/2 the signal sampling frequency.
If you're sample at
>> fs2/1E6
ans =
127.7400
>>
or 127 MHz, then when you plot the FFT, if your frequency vector is correct, your plot should go from
>> Fmax=ans/2
Fmax =
63.8700
>>
-63.87 to +63.87 MHz. If it doesn't, you've messed up; and that you get twice the value you think you should makes me think that's what you did...
I get you should have something like
L=1000; % arbitrary signal length
Fs=fs2; % your sample rate
f = (0:L/2)*(Fs/L); % compute the frequency vector (baseband one-sided)
f(end) % upper limit --> Fmax = Fs/2
ans =
63870000
>>
For your double-sided, you need to go from -L/2:L/2 to get the negative frequency as well, of course, but the maximum is still limited by Nyquist.
Thank you so much for your explanation
According to you, the frequency axis is between -63.87 and +63.87 MHz and it is correct, so I don't think the problem is due to the Nyquist frequency.
No -- that's the one I computed -- the one I got from your code as written is double that -- what do your plots of your original code show on the frequency axis?
If I take your code instead of mine above, I get
>> L=1000; % arbitary length; immaterial yours is n2
>> fs2 = 12774e4; % your sample rate
>> n2=L; % set your n2 to something
>> f2 = (0:n2-1)*(fs2/n2); % the way you computed the f vector
>> f2(end) % and your thus-computed Fmax
ans =
127612260
>>
You see that's returning the Fmax value as being (essentially) the same as the sampling frequency, or about double the Nyquist. That's what's doubling your results from what you think should be.
You see the difference in the two? There's an "L/2" in the (0:L/2) portion in mine but your's goes from (0:n2) so the maximum will be twice what mine produces. But, you've still got a 2-sided spectrum at
Signal_fft =fft(Signal_I + 1i*Signal_Q);
plot(f2,real(Signal_fft));
but you've plotted it against a baseband (0:Fs) frequency vector instead of one from (-Fmax:+Fmax). That's why you didn't have a length mismatch with the positive frequency of the FFT being only half as many points as the total -- you plotted both negative and positive frequencies.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Tags

Gefragt:

am 10 Aug. 2022

Kommentiert:

dpb
am 10 Aug. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by