Convolution of absolute magnitude =/= absolute magnitude of convolution?

209 Views Asked by At

I'd like to figure out what I'm doing wrong to cause this issue. Consider the (Matlab) code below:

A = [0.008912 0.0008934 -0.002584 0.003039 -0.002209 0.0007542 0.0005372 -0.0003424 -0.009147 0.03952 -0.05169 -0.07655 0.3637 -0.5018 0.1533 0.4625 -0.7134 0.3894 0.06538 -0.2249 0.1327 -0.02629 -0.006015 0.003311 0.000262 -0.0007913 0.0005139 0 -0.0004398 0.0005598 -0.0003478];
B = [-0.0017 0.002354 -0.001407 -0.0003384 0.001932 -0.002653 0.002321 -0.0002952 -0.003325 -0.01342 0.09965 -0.219 0.149 0.2581 -0.682 0.597 -0.02179 -0.4432 0.42 -0.1383 -0.04043 0.05345 -0.01858 0.002102 0 0.0003302 0 0 0 0 0];
H = [0.1986 0.4934 0.6589 0.4934 0.1986];
C = A + B*1j;

plot(abs(conv(C,H,'same')));
hold on;
plot(conv(abs(C),H,'same'));

Why are the two plots different? I thought

$$|C\ast H| = \left|\sum_{i} C[i]H[k-i]\right|$$ $$=\sum_{i} \sqrt{A[i]^2H[k-i]^2 + B[i]^2H[k-i]^2}$$ $$=\sum_{i} H[k-i] \sqrt{A[i]^2 + B[k]^2}$$ $$=\sum_{i} H[k-i]\cdot|C[i]|$$ $$= |C| \ast H$$