フィルターのクリア

getting X domain as Frequency when applying FFT

2 ビュー (過去 30 日間)
kobi
kobi 2013 年 12 月 31 日
コメント済み: HS Kim 2016 年 11 月 21 日
hi everyone,
i have data of Volt Vs Second of some measurment i did. i plotted this data and made dft(fft) on this data in order to get into the frequency domain and to filter some noise by a bandstop filter.
the problem is that when i make fft, the x axis is not Frequency. how can i invert it to Frequency so i can know in what Hz i have nosie.
tnanks a lot

回答 (2 件)

Wayne King
Wayne King 2013 年 12 月 31 日
編集済み: Wayne King 2013 年 12 月 31 日
You have to know the sampling frequency, which is the reciprocal of the difference between your time increments. I'm assuming that your time instants are evenly spaced. I'll assume you know your sampling frequency, but you can get if from your time vector if you do not.
Here is how to create a frequency vector.
t = 0:1/1000:1-1/1000;
x = cos(2*pi*100*t);
xdft = fft(x);
xdft = xdft(1:length(x)/2+1); % even length signal
Fs = 1000;
df = Fs/length(x);
freqvec = 0:df:Fs/2;
plot(freqvec,abs(xdft))
If you have the Signal Processing Toolbox, use periodogram() that will output a meaningful frequency vector for you.
  1 件のコメント
HS Kim
HS Kim 2016 年 11 月 21 日
I think you uesd "xdft(1:length(x)/2+1)" for deleting mirror image that will be happended by 'abs(xdft)' in plot, right?? I learned that plot(freq, abs(dtft)) then mirror image is happened if do plot without dtft/2. Please let me know exactly. Thank you :D

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


kobi
kobi 2013 年 12 月 31 日
thanks Wayne King, your information really helped me but on a second thought i don't even have to invert my signal into the frequency domain because when i use filter() i need the time domain signal and the notch filter.In case that i know the speciefic frequency i can design the notch filter to filter the noise. Am i wrong ? when i am doing it i get a side affect of nise in other frequencies that weren't be there before...
  1 件のコメント
Wayne King
Wayne King 2013 年 12 月 31 日
You are not wrong. If you want to filter your signal, then do it that way -- using filter()

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

カテゴリ

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