%Demonstration of why logarithmic scaling yields an approximately constant %error interval. clear; figure(1); clf; hold on; x=[randn(500,1); randn(500,1)*4; randn(500,1)*10; randn(500,1)*15]; m=[ones(500,1); ones(500,1)*4; ones(500,1)*10; ones(500,1)*15]; x=x.^2; m=m.^2; subplot(121); hold on; plot(x,'k.'); h(1)=plot(m,'r'); [c]=chi2confPH(0.95,2); h(2)=plot(m*c(1),'r--'); h(3)=plot(m*c(2),'r--'); set(h,'linewidth',3); axis([0 2000 0 1500]); subplot(122); hold on; plot(x,'k.'); h(1)=plot(m,'r'); h(2)=plot(m*c(1),'r--'); h(3)=plot(m*c(2),'r--'); set(gca,'yscale','log'); set(h,'linewidth',3); axis([0 2000 1e-3 1500]);