How to find frequency of a given data?
2 ビュー (過去 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
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
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 Center および File Exchange で Parametric Spectral Estimation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!