Stack Exchange
MATLAB - Matrix dimensions must agree (although they are "agreed"!)
Here is the code:
fs = 22050;
x = rand(fs,1);
x = x - mean(x); % get rid of DC offeset

% set comb-filter coefficients
f = 220; % fundamental
L = round(fs/f); % delay length 
coef = 0.99; % IIR coefficient

% build delay vector and filter 
b = [1 zeros(1,L-1) coef];
y = filter(1, b, x);

% create amplitude envelope for output 
decay = 8;
expEnv = exp ((0:(length(y)-1))/length(y));
expEnv = (1./expEnv).^ decay;
fprintf('%d\n',length(expEnv));
fprintf('%d\n', length(y));

% envelope output signal
z = y .* expEnv;
sound(z , fs); % play sound

It refuses to execute the z = y.*expEnv line. The printf lines shows that both y and expEnv have the same length (22050)

Yes...the dangers of the length command. 
although they have the same number of elements, they do not have the same shape: 
>> size(y)
ans =
       22050           1
>> size(expEnv)
ans =
           1       22050

This will fix that: 
z = y .* expEnv.';


Yes, the transpose! Such a rockie mistake :)
