Hi folks,
This might seem as much of a signal processing question as a MATLAB one. Recently while doing work some work I came across a problem while working with some large datasets. I found that when downsampling the data before filtering, like this arbitrary example: data(1:downsample:end), that I didn't get an expected response. Afterwards I then downsampled after filtering, like so: filtered_data(1:downsample:end) and got an expected response.
Therefore it seems as though it matters when you downsample, which I didn't realize or understand a the time.
So for the sake of this example, to make the question simple I made two vectors in Matlab. One a 90 element matrix, m=1:90.
Then another, a 45 element matrix with every second sample from 'm' missing, n=1:2:90.
Now using arbitrary filter coefficients 'a' and 'b', I filtered both datasets.
filter1= filtfilt(b,a,m); filter2=filtfilt(b,a,n);
Now, I would have expected every element of'filter2' to be identical to every second element of 'filter1' i.e. filter2(2)=filter1(3), however that was not the case. For example, the first four elements of each filtered data set were: filter1 = [4.1776, 4.8390, 5.5221, 6.2264] and filter 2 = [10.0973, 11.3274, 12.5811, 13.8564].
I was wondering whether anybody perhaps knew why every element of filter 2 was not equal to every second element of filter 1, or could point me in the direction of further reading. To this point, I have not managed to find an answer.
Thanks a lot!
Best Answer