Question
Work
I'm attempting to do this in MATLAB.
I know that for discrete Random Processes going into an LTI system the autocorrelation function of the output is $R_y[n] = h[n]\star h[-n]\star R_x[n]$ where $\star$ is convolution.
The two tap Haar filters are: h1 = [0.707 0.707]
and h2 = [0.707 -0.707]
which are orthonormal to each other.
I also know that transform coding gain is defined this way:
$$G = \frac{1}{N}\frac{\displaystyle\sum_{i=0}^{N-1} \sigma_i^2}{\left(\displaystyle\prod_{i=0}^{N-1} \sigma_i^2\right)^{\frac 1N}}$$
where $N$ is the number of samples (3 in this case?) and $\sigma_i$ is the variance of the $i$th transform coefficient.
This is my code:
h1 = 1/sqrt(2).*[1 1];
h2 = 1/sqrt(2).*[1 -1];
y1 = conv(x,conv(h1,fliplr(h1)))
y1 = 4.6500 14.3000 19.3000 14.3000 4.6500
y2 = conv(x,conv(h2,fliplr(h2)))
y2 = -4.6500 4.3000 0.7000 4.3000 -4.6500
After decimation:
Y1 = 4.6500 19.3000 4.6500
Y2 = -4.6500 0.7000 -4.6500
Calculated coding gains:
GTC1 = 9.533/(417.3134)^(1/3) = 1.2757
GTC2 = -2.8667/(15.1358)^(1/3) = -1.1589
My questions:
Am I calculating $y_1$ and $y_2$ correctly? As I understand it these are supposed to be the autocorrelation functions for a WSS Gaussian random process (because WSS into LTI gives WSS out). After decimation, can i use $Y_1$ and $Y_2$ to calculate coding gain? I'm getting a negative coding gain for the second channel ($Y_2$), does that make sense?
EDIT: Just realized that the Haar filters need not be 2 tap filters. Now I am more lost than before.