function rec = improvedrec(w,wc,p)
% wc is the compressed data vector; p is block size
% w is the data vector
% Reconstructs data from compressed data 
N = length(w);
A = lpcA(p,w);
V = wc(p+1:2*p)';
f = lpcreconstruct(wc(1:p),wc(p+1:2*p),N);
e = (f(p+1:N)-w(p+1:N))';
Y = f(p+1:N);
rec(1:p)=wc(1:p);
for k = 1+p:length(wc)-p
    rec(k) = (wc(k+p) ~= 0)*wc(k+p) + (wc(k+p) == 0)*Y(k-p);
end
