MATLAB에서 푸리에 변환을 올바르게 사용하고 있는지 궁금합니다. 나는 노래의 주파수에 대한 모든 평균 진폭을 갖고 싶다. 테스트 목적으로 나는 Audacity을 사용하여 8 kHz 모노 웨이브 파일로 변환 한 a free mp3 download of Beethovens "For Elise"을 사용하고 있습니다.푸리에 변환을 올바르게 사용하고 있습니까?
clear all % be careful
% load file
% Für Elise Recording by Valentina Lisitsa
% from http://www.forelise.com/recordings/valentina_lisitsa
% Converted to 8 kHz mono using Audacity
allSamples = wavread('fur_elise_valentina_lisitsa_8khz_mono.wav');
% apply windowing function
w = hanning(length(allSamples));
allSamples = allSamples.*w;
% FFT needs input of length 2^x
NFFT = 2^nextpow2(length(allSamples))
% Apply FFT
fftBuckets=fft(allSamples, NFFT);
fftBuckets=fftBuckets(1:(NFFT/2+1)); % because of symetric/mirrored values
% calculate single side amplitude spectrum,
% normalize by dividing by NFFT to get the
% popular way of displaying amplitudes
% in a range of 0 to 1
fftBuckets = (2*abs(fftBuckets))/NFFT;
% plot it: max possible frequency is 4000, because sampling rate of input
% is 8000 Hz
x = linspace(1,4000,length(fftBuckets));
bar(x,fftBuckets);
출력은 다음과 같습니다 : 내 코드가 맞다면
- 누군가가 말해 주시겠습니까 다음과 같이
내 MATLAB 코드는? 나는 특히 주위의 봉우리에 대해 궁금합니다.
- 정규화를 위해
NFFT
또는length(allSamples)
으로 나눌 필요가 있습니까? - 나를 위해 이것이 막대 차트처럼 보이지는 않지만 이것은 내가 계획하고있는 많은 값들 때문이라고 생각하십니까?
어떤 힌트를 주셔서 감사합니다!
이 페이지를 보았습니까? [FFT를 사용하여 간단한 스펙트럼 분석 플롯 얻기] (http://www.mathworks.com/support/tech-notes/1700/1702.html). 설명이 풍부한 예제가 있습니다. – Amro