필터 지우기
필터 지우기

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

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 CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by