You are on page 1of 13


Se utiliza con el fin de evitar que las discontinuidades introducidas al analizar solo una fracción de la señal o al introducir muestras con valor de cero introduzcan componentes de alta frecuencia en el espectro, que son mas bien un artificio de las discontinuidades introducidas y no de la señal. Ya que la transformada rápida de Fourier asume que la señal es periódica, es conveniente siempre hacerle un procedimiento de ventaneo a la señal con la que se quiere trabajar. MATLAB cuenta con diferentes tipos de ventanas como:
         

Hamming Hanning Bartlett Blackman Boxcar Triangular Gauss Blackmanharris Kaiser Dolph-Chebyshev

Ventana Hamming
w=wavread('danih.wav'); h=hamming(length(w)); x=w.*h; subplot(3,1,1),plot(w),grid on, zoom,title('hola.wav') subplot(3,1,2),plot(h),grid on, zoom,title('ventana hamming') subplot(3,1,3),plot(x),grid on, zoom,title('multiplicacion de hola con la ventana hamming')

zoom on .Sonido y resultado después de pasarlo pro la ventana Hamming Ahora visualizamos el espectro esp=abs(fft(x). plot(esp).title('Espectro con la Ventana Hamming').grid on.

Espectro del sonido después de pasarlo por la ventana Compare el sonido original con el sonido resultante .

*h.grid on.plot(h). x=w.1.2).1).plot(x).wav') subplot(3. subplot(3.1. zoom.3).title('ventana hanning') subplot(3. h=hanning(length(w)).title('multiplicacion de hola con la ventana hanning') Sonido y resultado después de pasarlo pro la ventana Hanning . zoom.Ventana Hanning w=wavread('danih.1.plot(w).title('hola. zoom.grid on.wav').grid on.

zoom on Espectro del sonido después de pasarlo por la ventana Compare el sonido original con el sonido resultante .grid on.Ahora visualizamos el espectro esp=abs(fft(x).title('Espectro con la Ventana Hanning'). plot(esp).

zoom. x=w.2). zoom.2). subplot(3.grid on. plot(esp). zoom.wav') subplot(3.title('Espectro con la Ventana kaiser').grid on.3). zoom on .1).1.grid on.plot(h).title('multiplicacion de hola con la ventana kaiser') Sonido y resultado después de pasarlo pro la ventana kaiser Ahora visualizamos el espectro esp=abs(fft(x).Ventana Kaiser w=wavread('danih.plot(x).grid on. h=kaiser(length(w).plot(w). 0.1.title('hola.title('ventana kaiser') subplot(3.1.wav').*h.

Espectro del sonido después de pasarlo por la ventana .

m. % Default parameters.3 Discrete Windowed Fourier Transform.1). i. sig. n+1 by n complex matrix % Side Effects % Image Plot of the Window Fourier Transform % Description % Algorithm % supposes signal is non-periodic. "A Wavelet Tour in Signal Processing". default=1 % Name string: 'Rectangle'. % specgm = WindowFT(sig).from Wavelet Scale Spectra by Charles Rino Compute wavelet scale spectra from segmented discrete wavelet transform (Screenshot). WindowFT(sig. n = length(sig). 'Blackman'.2. . if nargin < 4. if nargin < 3. 'Hamming'.Name. % 4. % 'Gaussian'. if nargin < 2. m=1.1)].Name. end.m. titl = [].w. default = n/2 % m inter-window spacing. zero-padded % Example % sig = ReadSignal('Caruso'). % See Also % MakeWindow IWindowFT % References % Mallat. Name = 'Rectangle'. if nargin < 5. w = n/2. % sig = sig(1:128). % sig = sig(:). % Initialize output matrix. zeros(n.titl) % WindowFT -. Default is 'Rectangle' % titl Optional Title String Modifier % Outputs % specgm Window Fourier Transform of sig.w.titl) function specgm = WindowFT(sig. f = [zeros(n.e. end.Name.m.titl) % Inputs % sig 1-d signal % w window half-length. end. 'Hanning'.w.Window Fourier Transform % Usage % specgm = WindowFT(sig. end.

3*n).fr.n/2. Xiaoming Huo % % Modified by Maureen Clerc and Jerome Kalifa.*win.nw).256*(specgmShowspmin)/(spmax-spmin)).stanford.n/2+1). tim = n + t + ix. kalifa@cmapx. localspec = fft(totseg(n+1:2*n)).polytechnique.:)). seg = f(tim). totseg = zeros(1. specgm( % % % % % % Part of Wavelab Version 850 Built Tue Jan 3 13:20:43 EST 2006 This is Copyrighted Material For Copying permissions see COPYING. end % % Make Window Fourier Transform Display specgmShow = abs(specgm(1:(n/2+1). seg = seg.w).l) = localspec(1:n)'. % Computing Window Fourier Transform for l=1:nw.polytechnique. 1997 % clerc@cmapx. spmax = max(max(specgmShow)). spmin = min(min(specgmShow)). totseg(tim) = seg. specgm = zeros(n. win = MakeWindow(Name.nw = floor(n ./ m).m Comments? e-mail wavelab@stat. %window = rshift(window')'.n). specgm = []. win = win(:). colormap(1-gray(256)) image(linspace( .n.linspace(0. ix = ((-w):w). t = 1+ (l-1)*m. axis('xy') xlabel('') ylabel('Frequency') if nargout==0. end % % Copyright (c) 1996.

Start by forming a time axis for our data. A common use of FFT's is to find the frequency components of a signal buried in a noisy time domain signal. Add some random noise with a standard deviation of 2 to produce a noisy signal y. running from t=0 until t=. t = 0:. First create some data.25. Then form a signal. x.001:. y = x + 2*randn(size(t)). x = sin(2*pi*50*t) + sin(2*pi*120*t). containing sine waves at 50 Hz and 120 Hz. Take a look at this noisy signal y by plotting it.Search R20    MATLAB MATLAB Examples FFT for Spectral Analysis This example shows the use of the FFT function for spectral analysis. Consider data sampled at 1000 Hz.25 in steps of 1 millisecond. plot(y(1:50)) title('Noisy time domain signal') .

Y = fft(y. f = 1000/251*(0:127).*conj(Y)/251.) Pyy = Y.251). Finding the discrete Fourier transform of the noisy signal y is easy. that's why spectral analysis is so popular. (The remainder of the points are symmetric. a measurement of the energy at various frequencies.Clearly. it is difficult to identify the frequency components from looking at this signal. Form a frequency axis for the first 127 points and use it to plot the result. Compute the power spectral density. just take the fastFourier transform (FFT).Pyy(1:128)) title('Power spectral density') xlabel('Frequency (Hz)') . using the complex conjugate (CONJ). plot(f.

Zoom in and plot only up to 200 Hz.Pyy(1:50)) title('Power spectral density') xlabel('Frequency (Hz)') . plot(f(1:50). These are the frequencies of the original signal. Notice the peaks at 50 Hz and 120 Hz.