how to acces the points on the fft plot.
조회 수: 3 (최근 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!