Why will be obtained FWHM in the frequency domain twice the value expected?
Ältere Kommentare anzeigen
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
dpb
am 10 Aug. 2022
First guess might be you didn't divide by two to set Fmax???
What's the code you used to define the frequency?
dpb
am 10 Aug. 2022
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.
zahra
am 10 Aug. 2022
dpb
am 10 Aug. 2022
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.
Antworten (0)
Kategorien
Mehr zu Spectral Measurements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!