will processing a fragment of a wave file result in artifacts in the frequency domain?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello everybody, this is my first post in the forum.
I need to do some processing on a wav file in order to distinct between two components. One coming directly from a sound source and another coming from a later reflection on an object. I need to process the two components in time separately. My question is, if the wave file 'my_wavfile' has let's say 1000 samples and the first component extends from sample '100:300' and the second from '500:800' then F=fft(my_wavfile(100:300)) will it create any artifacts in F because of cutting out the rest of the samples in the time domain?
I don't have a strong background in signal processing and any help would be appreciated
0 comentarios
Respuesta aceptada
Wayne King
el 9 de Mayo de 2012
Again, these vectors are not equal so the DFT will not be equal. The length of the two DFTs are not equal
f1=[1 2 3 4 5]
f2=[1 2 3 4 5 0 0 0 0];
length(fft(f1))
length(fft(f2))
If you're getting at zero-padding, then zero-padding definitely changes the result of the DFT as expected.
t = 0:0.001:1-0.001;
x = cos(2*pi*100*t);
xdft = fft(x); % length 1000
% now add zeros out to length 1024
xdft1 = fft(x,1024);
Qualitatively, these give the same picture.
plot(abs(xdft))
figure;
plot(abs(xdft1))
but they are clearly not equal. Remember the Fourier transform is 1-to-1.
0 comentarios
Más respuestas (4)
Wayne King
el 9 de Mayo de 2012
You will be ok. The main issue that you will have is frequency resolution. By reducing your signal size from 1000 down to 300 samples, your frequency resolution is going to decrease from Fs/1000 where Fs is your sampling frequency to Fs/300.
Fs = 1e3;
t = 0:0.001:1-0.001;
x = cos(2*pi*100*t).*(t<0.3)+cos(2*pi*200*t).*(t>0.3);
plot(abs(fft(x)))
plot(abs(fft(x)))
figure;
x1 = x(1:300);
plot(abs(fft(x1)))
0 comentarios
Wayne King
el 9 de Mayo de 2012
The DFT (implemented by fft()) is an invertible operator, which means it is 1 to 1. Even though you are just considering the abs() in this case (which can result in different vectors looking the same), replacing the last 500 samples by zeros is a VERY different waveform than the original. In other words
x = [1 2 3 4 5 4 3 2 1];
y = [1 2 3 4 5 0 0 0 0];
are very different so why would you expect their Fourier transforms not to be different?
fft(x)
fft(y)
0 comentarios
Ver también
Categorías
Más información sobre Discrete Fourier and Cosine Transforms en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!