will processing a fragment of a wave file result in artifacts in the frequency domain?
Show older comments
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
Accepted Answer
More Answers (4)
Wayne King
on 9 May 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)))
buscuit
on 9 May 2012
0 votes
Wayne King
on 9 May 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)
buscuit
on 9 May 2012
Categories
Find more on Frequency Transformations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!