function f = deconvolvevectors(a,b) <a> is a vector with the convolved data <b> is a vector with the thing to deconvolve out deconvolve <b> from <a>, returning a vector the same length as <a>. note that this overlaps somewhat with the functionality of deconv.m. example: a = randn(1,10); b = [1 2 1]; c = conv(a,b); a2 = deconvolvevectors(c,b); allzero(a2-[a 0 0])
0001 function f = deconvolvevectors(a,b) 0002 0003 % function f = deconvolvevectors(a,b) 0004 % 0005 % <a> is a vector with the convolved data 0006 % <b> is a vector with the thing to deconvolve out 0007 % 0008 % deconvolve <b> from <a>, returning a vector the same length as <a>. 0009 % note that this overlaps somewhat with the functionality of deconv.m. 0010 % 0011 % example: 0012 % a = randn(1,10); 0013 % b = [1 2 1]; 0014 % c = conv(a,b); 0015 % a2 = deconvolvevectors(c,b); 0016 % allzero(a2-[a 0 0]) 0017 0018 X = conv2(eye(length(a)),b'); 0019 X = X(1:length(a),:); 0020 f = (olsmatrix(X)*a')';