How to find frequency of a given data?

조회 수: 1 (최근 30일)
Edin Michael
Edin Michael 2019년 5월 19일
댓글: dpb 2019년 5월 20일
I have a data whose sampling freqency is 16000/s.
This is the code that I am using to find the freqency.
Is this the right way?
If there is a better way, I would like to learn that.
drate = 16000;
nr = 2^13;
delt = 1/(drate);
padd=2;
freq=zeros(1,nr*padd/2);
T=freq;
for k=1:nr*padd/2
freq(k)=(k-1)/(nr*padd*delt);
T(k)=(k-1)*delt;
end
U = Flap_w;
U = U - mean(U);
Uf=fft(U,nr*padd);
psd=zeros(1,nr*padd/2);
for l=1:nr*padd/2
psd(l)=abs((delt/nr)*(Uf(l))^2);
end
plot(freq,psd,'-b','linewidth',1.0);
xlim([0 8000]);
ylim([0 0.015]);
grid on
xlabel('$frequency (Hz)$','interpreter','latex','fontname','arial','fontsize',12);
ylabel('$PSD (a.u.)$','interpreter','latex','fontname','arial','fontsize',12);
  댓글 수: 4
Erik Muller
Erik Muller 2019년 5월 20일
If youre simply looking for frequencies, then it makes no difference if the signal has positive or negative values, you're just looking for the rate that the signal osccilates and what other signals are present.
I got an error with your code because Flap_w isnt defined, but it might be useful for you to look at questions that are similar - finding dominant frequency in a time series data using fft
Not sure if it's helpful, but maybe you can use the code in the link above, to guide you?
E
dpb
dpb 2019년 5월 20일
And why would you think otherwise? One of the most common uses would be on such waveforms and even if weren't one generally will make it contain both by detrending and subtracting mean (DC component).
As noted, the example in the documentation has it all laid out including how normaliztion works.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Parametric Spectral Estimation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by