Why will be obtained FWHM in the frequency domain twice the value expected?
2 views (last 30 days)
Show older comments
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 Comments
dpb
on 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.
Answers (0)
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!