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!