function P = PredictionwithWavelets(model,n,rank)

B = [];
%0th iteration
%pred = arpred(model,n,ceil(length(model)/4));
%size(pred)

C = components(model,rank,'n');  %get components based on the current size of the data array
[rows cols] = size(C);
figure;
subplot(2,1,1);
for (i=1:cols)
    ar_order = ceil(length(C(:,i))/4);
    Ap = arpred(C(:,i),n,rank);
    B = [B Ap];
temp = (Ap-mean(Ap));
pC = temp./max((temp)-min(temp))+(cols-i+1)*ones(length(Ap),1);
     plot(pC,'black');
     hold on;
     plot(length(pC),pC(length(pC)),'*','Color','black');
  
     ylabel('Resolution Level');
     xlabel('Translate');
end
P = sum(B,2);
     subplot(2,1,2);
     plot(P,'black');
     hold on;
     plot(length(P),P(length(P)),'*','Color','black');
     title('De-noised Set and Prediction');
     ylabel('normalized counts');
     xlabel('dates');
     

