MATLAB code for calculating the centre frequency of a signal?

27 views (last 30 days)
i need to find the centre frequency for any given signal and i need to caalculate the beamwidth for the given signal so that with this given code i can find out the code for any AM OR FM signal

Answers (1)

Walter Roberson
Walter Roberson on 8 Feb 2014
t = abs(fft(YourSignal));
t(1) = [];
tmax = max(t);
t(ceil(end/2):end) = [];
abovecutoff = t > tmax / 2; %3 dB is factor of 2
lowbin = find(abovecutoff, 1, 'first');
highbin = sum(abovecutoff);
centbin = sqrt(lowbin * highbin); %geometric mean
Now you know that floor(centbin) is the fft bin containing the center frequency. But you don't know the center frequency itself. To know the frequency itself you need to convert between bin numbers and frequencies, which depends upon your sample resolution -- which is something that cannot be know from just the signal itself.
Here I am using "fft bin number" in the sense of bin #1 corresponding to 1 cycle/period, bin #2 corresponding to 2 cycles / period, and so on.
Having code on hand you should now be able to refer back to your textbook definitions of fft and of centre frequencies and cutoff frequencies in order to figure out how the code works. I am not going to document it here as it is your assignment to figure out how to calculate these things.

Tags

Community Treasure Hunt

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

Start Hunting!