%decdis
function D_rmp_displayP(hn,bloch,Z,original)

if hn==1
% 
 mZ=min(min(Z));
    mb=min(min(bloch));
Mz=max(max(Z));
Mb=max(max(bloch));
MZ=max(Mz,Mb);
mz=min(mZ,mb);
D_ondis1(bloch,Z,original,mz,MZ)

else
  figure(5);subplot(1,2,1);
  
  [PSNz ~]=psnB(bloch,Z);
    aj(Z); title(['\fontsize{20}Blurred and noised, PSNR='  num2str(PSNz)])
    set(gca,'YTick',0:256:512);set(gca,'YTickLabel',{})
set(gca,'XTick',0:256:512);set(gca,'XTickLabel', {})




        subplot(1,2,2);
  [PSNo ~]=psnB(bloch,original);
    aj(original); title(['\fontsize{20}Restored image, PSNR='  num2str(PSNo)])
   set(gca,'YTick',0:256:512);set(gca,'YTickLabel',{})
set(gca,'XTick',0:256:512);set(gca,'XTickLabel', {})

 
  D_plot_column1(bloch,Z,original)
    
    
end
function D_plot_column1(bloch,Z,original)

pli=input('# of column to plot;0-none; ?')
if pli>0
    b=bloch(:,pli);  z=Z(:,pli); o=original(:,pli);
    mZ=min(min(z));
    mb=min(min(b));
Mz=max(max(z));
Mb=max(max(b));
MZ=max(Mz,Mb);
mz=min(mZ,mb);
D_ondis1(b,z,o,mz,MZ)
D_plot_column1(bloch,Z,original)
end
function D_ondis1(bloch,Z,original,mz,MZ)

figure; subplot(1,2,1)
plot(Z,'b','LineWidth',2);

hold on;
plot(bloch,'k--','LineWidth',2)
hold off;
axis([1,512,mz-5,MZ+5])
set(gca,'YTick',0:256:512);set(gca,'YTickLabel',{})
set(gca,'XTick',0:256:512);set(gca,'XTickLabel', {})




subplot(1,2,2)
plot(original,'b','LineWidth',2);
hold on;

plot(bloch,'k--','LineWidth',2)
hold off;
axis([1,512,mz-5,MZ+5])
set(gca,'YTick',0:256:512);set(gca,'YTickLabel',{})
set(gca,'XTick',0:256:512);set(gca,'XTickLabel', {})

