フィルターのクリア

how to find max frequency of a signal in matlab?

49 ビュー (過去 30 日間)
D.M
D.M 2017 年 3 月 2 日
コメント済み: Jason Christensen 2023 年 3 月 10 日
Answer of this question is very important for my project.plz help me.
  1 件のコメント
Jason Christensen
Jason Christensen 2023 年 3 月 10 日
% Example from: https://www.mathworks.com/help/matlab/ref/fft.html
% At the end I use max() to determine the max frequency of the signal
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 1500; % Length of signal
t = (0:L-1)*T; % Time vector
S = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
X = S + 2*randn(size(t));
plot(1000*t(1:50),X(1:50))
title("Signal Corrupted with Zero-Mean Random Noise")
xlabel("t (milliseconds)")
ylabel("X(t)")
Y = fft(X);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
plot(f,P1)
title("Single-Sided Amplitude Spectrum of X(t)")
xlabel("f (Hz)")
ylabel("|P1(f)|")
Y = fft(S);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
plot(f,P1)
title("Single-Sided Amplitude Spectrum of S(t)")
xlabel("f (Hz)")
ylabel("|P1(f)|")
[MaxValue, MaxIndex] = max(P1);
max_freq = f(MaxIndex)
max_freq = 120

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

回答 (4 件)

KSSV
KSSV 2017 年 3 月 2 日
Read about fft and max
  1 件のコメント
D.M
D.M 2017 年 3 月 2 日
Describe please.

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


Walter Roberson
Walter Roberson 2017 年 3 月 2 日
You can only find the maximum frequency in a signal under limited conditions that do not often apply in real life.
To be able to find the maximum frequency of a signal, the signal needs to be exactly representable as the sum of sines or sum of cosines (so it has to be theoretically periodic), and the maximum frequency of the sines or cosines must not exceed half of the sampling frequency.
These conditions do not apply for human speech, for example: human speech has a lot of sudden onsets and sudden stops of sound, and the maximum frequency involved in a sharp sound boundary is infinite.
Likewise, if someone were to play you a pure tuning-rod A440 for 10 seconds, and then were to silence it and you had 5 seconds silence, then that sharp end of sound involves frequencies beyond anything you are likely to be recording with.
  2 件のコメント
D.M
D.M 2017 年 3 月 2 日
what is the procedure to find the max freq of human speech?
Walter Roberson
Walter Roberson 2017 年 3 月 2 日
The maximum frequency of human speech is infinite.

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


Star Strider
Star Strider 2017 年 3 月 2 日
In a sampled signal, the maximum frequency you can use is the Nyquist frequency defined as half the sampling frequency. Analog-to-digital converters routinely use hardware anti-aliasing filters (generally Bessel design) to prevent any frequencies higher than the Nyquist frequency from being sampled.
For communications purposes, the human voice spectrum is considered to be 0 to 6 kHz.
  1 件のコメント
Walter Roberson
Walter Roberson 2017 年 3 月 2 日
Digital Telephony is designed around 8000 samples per second at either 7 or 8 bits per sample, leading to either 56000 bits per second or 64000 bits per second (the 8th bit is used for timing in the 7 bit cases). This is the ISDN rate, with lines being defined in terms of multiples of that rate. This does imply that nothing over 4kHz might get transmitted.
But the communications line restriction is not the same as what the maximum frequency is. You can, though, figure out what the maximum frequency of conveyed by a particular sampled signal is, using fft and knowledge of the sampling frequency. But even then for practical reasons you usually end up having to quantize to account for round off error.

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


UET Hussain
UET Hussain 2018 年 11 月 27 日
I think I got what you want.
The easiest way is to use small section of data (like if your data is of 10 seconds, get 40 or 80 equal sections of the data, hence each section will be of 250 or 125ms). Now you may use meanfreq or medfreq function (available in Matlab 2015 onwards), to get the mean frequency of 125ms data section. store the 80 values in an array and take maximum from that.
I think it should work for most of the cases. Otherwise, as mentioned by other experts, usually the highest frequency is half the sampling rate.

カテゴリ

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