How to find frequency of a given data?

1 次查看(过去 30 天)
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