h=[]; omega_p=5; omega=10^(omega_p/10); for i=1:1:10000 h=[h sqrt(omega/2)*randn(1,1)+1i*sqrt(omega/2)*randn(1,1)]; end subplot(2,2,1) cdfplot(abs(h)) %you need to Open cdfplot then add 'o' on line 58 %turn hCDF = plot(xCDF , yCDF); to hCDF = plot(xCDF , yCDF,'o') hold on x=0:0.01:6; y_cdf=1-exp(-x.^2/omega); plot(x,y_cdf); legend('Simulation curve','theoretical curve'); title('|h|-cdf') subplot(2,2,2) [y_pdf,x]=ksdensity(abs(h)) ; plot(x,y_pdf,'o'); hold on y_pdf_t=2*x./omega.*exp(-x.^2/omega); plot(x,y_pdf_t); legend('Simulation curve','theoretical curve'); axis([0,6,0,0.5]); title('|h|-pdf') grid on subplot(2,2,3) cdfplot(abs(h).^2) hold on x=0:0.01:36; y_cdf=1-exp(-x/omega); plot(x,y_cdf); legend('Simulation curve','theoretical curve'); title('|h|^2-cdf') subplot(2,2,4) [y_pdf,x]=ksdensity(abs(h).^2) ; plot(x,y_pdf,'o'); hold on y_pdf_t=1/omega.*exp(-x/omega); plot(x,y_pdf_t); legend('Simulation curve','theoretical curve'); axis([0,36,0,0.4]); title('|h|^2-pdf') grid on