how can i measure the frequency of a periodic signal in real time?

4 views (last 30 days)
Hi everyone, I have an external signal and i want to have a real time measurement of it's frequency in Simulink.The frequency of the signal is changing in an arbitrary way over time between 49 and 51 Hz.I am searching this for over a month and i have not found an acceptable solution. Anyone has any idea about this? Thank you in advance!

Answers (2)

Doug Hull
Doug Hull on 6 May 2011
Alex,
There are many parts to this question.
  1. getting external signal
  2. calculating the peaks
  3. do you need to reject noise in finding the peaks?
  4. if you can identify peaks, can you calculate the frequency
What have you done for each of these steps? Please modify the question to reflect these answers.

Alex
Alex on 7 May 2011
Doug,
The external signal is a sinusoide(with small harmonics).It comes from an A/D card but this is not my concern.Let's assume we have a sinusoidal signal with small harmonics in a Simulink model.I want to measure only the fundamental frequency.And by measure i mean not only watch the spectrum of the signal in a scope but have a signal(frequency over time) which will be an input to another block.
I didn't think about calculating the peaks.I have thought finding the zero crossings instead BUT there is a serious problem: My project has a fixed step solver with Ts=1/8000.So when the frequency is not an exact product of Ts my measurement has a deviation of 0.1-0.4 Hz which is not acceptable. I didn't get the "reject noise in finding peaks".Do you still mean finding peaks of the signal or have i misunderstood you?
Another thought i had was to calculate the first derivative of the signal so i can extract the radical frequency from the sine but this is acceptable only with a clear sine wave(without harmonics)
If i have confused you please tell me to explain better.
Thank you very much for your response and i really hope you can help me further...

Community Treasure Hunt

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

Start Hunting!