Coding wavelets the easy way

function WT = WaveTransform(u,h,g,scale)
% returns wavelet transform of u using filter structure f
% at scale "scale"
% WT is structured
WT.LoRes = u;
WT.Details = cell(scale,1); % details are stored columnwise
for i = 1:scale
det = myconv(WT.LoRes,g);
WT.Details{i} = subsample(det);
lo = myconv(WT.LoRes,h);
WT.LoRes = subsample(lo);
end