normalisation of frequency axis while using fft function in matlab

2 ビュー (過去 30 日間)
Tejas
Tejas 2011 年 2 月 11 日
Hi all, As a part of my code, I have got a filtered array Va, which contains 45592 samples.What I need to do now is obtain the frequency spectrum of the signal which should have the major component as 50Hz. However, on applying plot(abs(fft(Va))), though I am getting 2 large peaks(i think a peak and its mirror image) at 2 points,I am not able to assess the X-axis scale.It is running from 0 to 50000.The peak I am getting is at approximately the 26th point and also the 45570th point.How do I adjust the x-axis so I can see the frequency component in Hz? Also, I am not sure about the sampling frequency, because the array is obtained using a m code after large number of iterations.Can somebody help?Thanks in advance.

採用された回答

Vieniava
Vieniava 2011 年 2 月 11 日
You must know frequency sampling, Fs . Look at this code:
Fs= ; % insert here your frequency sampling in Hz
L=length(Va);
NFFT = 2^nextpow2(L);
Y = fft(Va,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);
plot(f,2*abs(Y(1:NFFT/2+1)))
title('Single-Sided Amplitude Spectrum of y(t)')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
  6 件のコメント
Tejas
Tejas 2011 年 2 月 12 日
clear all
clc
close all
time=0:0.001:0.5;
Vm=230;
freq=50;
Va = Vm*sin(2*pi*freq*time);
Vieniava
Vieniava 2011 年 2 月 12 日
Bulls eye! "time=0:0.001:0.5" that means your frequency sampling is 1/0.001 = 1000 Hz .

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

その他の回答 (1 件)

ilyas
ilyas 2012 年 6 月 5 日
What about the double-sided spectrum?
Thank you

カテゴリ

Help Center および File ExchangeSignal Processing Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by