In "Analyzing Cyclical Data with FFT" example, how the frequency was calculated?

and how it can be calculated for other examples? is there a general equation or formula to calculate it?

 採用された回答

Paul Hoffrichter
Paul Hoffrichter 2020 年 12 月 4 日
If n is even, the following is equivalent to your code:
f = linspace(2/n, 1, n/2) * maxfreq;

5 件のコメント

Notice that if n is odd, then for your formula:
freq = (1:n/2)/(n/2)*maxfreq
the largest frequency in the array will be less than maxfreq, whereas using linspace, the largest frequency will be maxfreq.
Keep in mind that n/2 in (1:n/2) becomes an integer whereas the other (n/2) remains a double. So, when n is odd, the two results for n/2 are different.
Muhamed Sewidan
Muhamed Sewidan 2020 年 12 月 4 日
yes I know, but I want to know the purpose of this variable and how to calculate it in other cases? is there any emprical formula for this variable?
What the meaning of this variable?
Paul Hoffrichter
Paul Hoffrichter 2020 年 12 月 4 日
>> meaning of this variable?
>> the purpose of this variable
freq is a range of frequencies to be used in any formula that requires frequecies. It's purpose varies depending upon the application. For example, if you take the FFT of a time series, you can get a plot of magnitude or phase vs. frequency.
>> is there any emprical formula for this variable?
You will have to be more specific as to what you are trying to accomplish. There are signals that have different shapes of frequency. For example, see https://en.wikipedia.org/wiki/Chirp where you can see some plots of the chirp waveform, and even listen to what it sounds like (although if the min/max frequency is high, you would not be able to hear it).
Muhamed Sewidan
Muhamed Sewidan 2020 年 12 月 4 日
Thank you for your fast response.
I have one more question, max frequency value, is it arbitrary or determined on what base?
Paul Hoffrichter
Paul Hoffrichter 2020 年 12 月 4 日
The frequency (in Hz, cycles per second) is very arbitrary depending upon the applications. If talking about radio frequencies, both the min and max frequencies are regulated in every country so that in a small geographical region, two radio stations will not collide with each other.
Although a radio station's frequency is a specific number, there is also a frequency region surrounding this central frequency. For example, if the station's carrier frequency, Fc, is is playing music whose frequecies can go up to 20KHz, then there will be a band of frequencies often from Fc - 20KHz ... Fc + 20KHz, which is a 40KHz bandwidth. So that station will be assigned at least that 40KHz (and probably more) centered on Fc.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with Signal Processing Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by