Comparing The Frequency of Two Signals With Periodogram

3 views (last 30 days)
I have a series of distorted sine waves that I am trying to determine the frequency of. It would appear that the periodogram function should allow me to do this but I am a little confused by the results.
I know my signals should be sinusoidal waves, so I decided to compare the results of periodogram on my 'ideal' and distorted ('turb') signals, both of which are 1x360 vectors, with the following code:
rotation = (0:length(ideal)-1);
[pI,fI] = periodogram(ideal,[],[],length(ideal));
[maxI,i] = max(pI); disp(fI(i));
[pT,fT] = periodogram(turb,[],[],length(turb));
[maxT,j] = max(pT); disp(fI(j));
fig = figure();
subplot(1,2,1); plot(rotation,ideal,'b-',rotation,turb,'k-')
subplot(1,2,2); plot(fI,pI,'b-',fT,pT,'k-');
which produces a figure like this:
I am not sure exactly what the figure on the right showing the output of periodogram should be telling me but as I understand it, it should show a peak at the frequency of my input function. For the ideal function this should be 6 (i.e. there are 6 oscillations over the course of my measurement). However the peaks of both functions are located at 6.3281. I cannot tell if the fact this is almost 6 is coincidental or if I have totally misunderstood what the periodogram function is telling me.
My question is, am I using the periodogram function the correct way to compare the frequency of two functions and if so why is it returning an inexact result for a perfect signal?
I would greatly appreciate any light that anyone could shed on this topic.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!