how to acces the points on the fft plot.
1 回表示 (過去 30 日間)
古いコメントを表示
i have the following code.i want the access of value of z1 at fs1=1000.
[z, f] = wavread('z.wav');
>> n=length(z)
n =
137728
>> fs1=(0:n-1)*(f/n);
>> z1=abs(fft(z));
plot(fs1,z1);
i have the values of z1 and fs1 separately.but i dont know how to find the value of z1 at specific fs1.plss help me with this.
would be really thankful.
0 件のコメント
採用された回答
Wayne King
2012 年 3 月 9 日
Hi, If the signal is real-valued, it is better to not use the whole result of fft() since you are looking at the absolute value.
The spacing of the DFT bins is Fs/length(input) as you note in your code above.
t = 0:0.001:1-0.001;
Fs = 1000;
x = cos(2*pi*100*t)+randn(size(t));
xdft = fft(x);
xmag = abs(xdft(1:length(xdft)/2+1));
freq = 0:Fs/length(x):Fs/2;
Now, how do we find the value of xmag that corresponds to 100 Hz?
The spacing between the DFT bins is Fs/length(x), so
df = Fs/length(x);
freqbin = round(100/df)+1;
xmag(freqbin)
Of course if you want the actual Fourier coefficient at that frequency
xdft(freqbin)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Fourier Analysis and Filtering についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!