% Optical Imaging and Spectroscopy % % David J. Brady % Duke University % www.opticalimaging.org % % figure 8.4 % % Comparison of transfer functions for MURA codes of various order % % % snr=10; hh1=1./(1+snr*ones(128,1)); p=13; qr=qres(p); t=zeros(p); t(2:p,1)=1; for i=2:p for j=2:p if qr(i-1)==qr(j-1) t(i,j)=1; end end end th=zeros(256); th(1:p,1:p)=t; th=1./(1+snr*abs(fftshift(fft2(th))).^2); t13=th(129:256,128); p=23; qr=qres(p); t=zeros(p); t(2:p,1)=1; for i=2:p for j=2:p if qr(i-1)==qr(j-1) t(i,j)=1; end end end th=zeros(256); th(1:p,1:p)=t; th=1./(1+snr*abs(fftshift(fft2(th))).^2); t23=th(129:256,128); p=41; qr=qres(p); t=zeros(p); t(2:p,1)=1; for i=2:p for j=2:p if qr(i-1)==qr(j-1) t(i,j)=1; end end end th=zeros(256); th(1:p,1:p)=t; th=1./(1+snr*abs(fftshift(fft2(th))).^2); t41=th(129:256,128); figure(1);set(gcf,'color','white'); x=linspace(0,1,128); semilogy(x,t13,'-k',x,t23,'--k',x,t41,'-.k',x,hh1,':k'); legend('p=13','p=23','p=41','p=1');xlabel('Spatial frequency');ylabel('relative error');