shape(D,nd(1)*nd(2),nd(3));

<span class="comment">% model params</span>
model.o    = o; model.d = d; model.n = n;
model.nb   = nb.*[1 1];
model.freq = od(3) + [0:nd(3)-1]*dd(3);
model.zsrc = zsrc;
model.xsrc = od(2) + [0:nd(2)-1]*dd(2);
model.zrec = zrec;
model.xrec = od(1) + [0:nd(1)-1]*dd(1);
model.f0   = f0;
model.t0   = t0;

Q = speye(nd(2));

<span class="comment">% generate outliers by replacing a fraction p of the data with</span>
<span class="comment">% random normal (0, a)</span>
s = RandStream.cr