フィルターのクリア

Calculating cycle frequency of a square wave

12 ビュー (過去 30 日間)
Kieran
Kieran 2011 年 9 月 1 日
コメント済み: anibal montenegro 2023 年 2 月 2 日
Hi,
I am currently analysing a speed signal in the form of square wave. The information I need is the frequency which is in the width of the square wave per cycle.
I need to plot the speed signal in the form of frequency versus time at the same sampling rate as the square wave. At the moment, the only method I can think of is using the zero crossing method and calculate the width between the point of rising slope and falling slope. Then, convert it to frequency.
My main concern is I have got about 5million data points and performing this calculation can be very time consuming. Plus, more than half of my data is affected by noise.
Can anyone please suggest an alternative method of getting the result I need?
Thank you.
Kieran
  2 件のコメント
Rick Rosson
Rick Rosson 2011 年 9 月 3 日
Are you using MATLAB or Simulink?
anibal montenegro
anibal montenegro 2023 年 2 月 2 日
hello. can you share de code please?

サインインしてコメントする。

回答 (3 件)

Walter Roberson
Walter Roberson 2011 年 9 月 3 日
zero-crossing can be fast:
transitions = find(diff(X > 0));
Then diff(transitions) should give the half-cycle timing. Sum consecutive pairs to get the points per cycle.

Rick Rosson
Rick Rosson 2011 年 9 月 3 日
You could try transforming the signal from the time-domain to the frequency domain, and then identifying the fundamental frequency and some of the lower order harmonics.
Also, do you need to perform the computation on all 5 million data points? If the signal is stationary, or if it changes relatively slowly, you may be able to estimate the frequency using a relatively small subset of the entire data set.
  1 件のコメント
Walter Roberson
Walter Roberson 2011 年 9 月 3 日
The poster indicated "I need to plot the speed signal in the form of frequency versus time", so the signal must not be stationary. Not enough information to know how quickly it is changing, though. Also it seems to me that since noise might affect the detection of a crossing, the problem could be complicated by determining whether a change in the timing is noise or a real change.

サインインしてコメントする。


Rick Rosson
Rick Rosson 2011 年 9 月 3 日
You may want to try using the spectrogram function:
>> doc spectrogram
HTH.
Rick

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by