how to implement hanning window with 50% overlap

조회 수: 10 (최근 30일)
Wil
Wil 2014년 9월 18일
편집: Walter Roberson 2025년 11월 1일
Hi there, I have a .wav file whic is attached here. I wish to get the sound pressure level (dB SPL re:1uPa) from this file and plot it against it's frequency components. Can someone check if my code is correct or what I need to do if it isn't. And very importantly, I need to apply a 'hanning window' with 50% overlap to my data, how do I do that?. Thanks very much for the anticipated helpful reply. Below is my code. Cheers.
% This reads in the .wav file
[data Fs] = wavread('C:wil.wav');
T = 1/Fs; % Sample time
L = length(data(:,1)); % Length of signal
t = (0:L-1)*T; % Time vector
x = data(:,1);
subplot(3,1,1), plot(t,x)
title('Signal')
xlabel('time (Seconds)')
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(x,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);
% Plot single-sided amplitude spectrum.
subplot(3,1,2), plot(f,2*abs((Y(1:NFFT/2+1))))
title('Magnitude of FFT')
xlabel('Frequency (Hz)')
ylabel('Amplitude')
xlim([0 10000]);
% Plot FFT in dB
subplot(3,1,3), plot(f,-10*(log10(abs((Y(1:NFFT/2+1)).^2))))
title('FFT in dB')
xlabel('Frequency (Hz)')
ylabel('Amplitude (dB)')
xlim([0 1000]);

답변 (2개)

José-Luis
José-Luis 2014년 9월 18일
Please make it easier for to help you and format your post.
Also, we don't have your sound file so we can't really run your code.
If you have the signal processing toolbox, Matlab has its implementation of the Hanning window called hann()
  댓글 수: 1
Wil
Wil 2014년 9월 18일
Thanks, I have attached one of the sound files

댓글을 달려면 로그인하십시오.


Ryan
Ryan 2025년 11월 1일
So im applying a Hann window to a 2d range image of .las point cloud. Current window overlapping is 50% could this result in smearing the range image? see 3d point cloud and resulting range image, my only other thought is that my projection may still be incorrect.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by