%Class for CO907, Tue, Week 1. %__________________________________________ %Author: Jiarui Cao %Date: 5 Nov 2013 %Purpose: Plot CDF and use it to study the tail close all; clear all; clc; clf; % x=-5:0.1:5; % f=normcdf(x,0,1); % Generate Gaussian CDF at values x % plot(x,f) hold on y=normrnd(0,1,1000,1); %y=binornd(10,0.8,[1000 1]); [g,t]=ecdf(y); % Get the empritical CDF function g(t) from data y plot(t,1-g,'om'); p=normcdf(t,0,1); %p=binocdf(t,10,0.8); plot(t,1-p); %set(gca,'Yscale','log'); % Log the y-axis hold off legend('Empritical','Theoritical');