% % Practical session 2 % % Normal distribution's PDF, c.d.f, and inverse c.d.f. % Testing for the mean using normal distribution (z-test) % t-test for the mean and differences between the means % % x=[-5:0.1:5]; y=normpdf(x,0,1); figure plot(x,y) grid on xlabel('x') ylabel('PDF') title('Standard normal distribution\prime s PDF') z=normrnd(0,1,10000,1); whos z % % Name Size Bytes Class % % z 10000x1 80000 double array % %Grand total is 10000 elements using 80000 bytes % % mean(z) var(z) dedges=(max(z)-min(z))/15; edges=[min(z):dedges:max(z)]; y1=histc(z,edges); whos y1 % Name Size Bytes Class % % y1 16x1 128 double array % %Grand total is 16 elements using 128 bytes % y1=y1/(mean(y1)*16*dedges); hold on plot(edges+dedges/2,y1,'ro') % % % i1=find(abs(z)<1); i2=find(abs(z)<2); i3=find(abs(z)<3); p1=size(i1,1)*100/10000 p2=size(i2,1)*100/10000 p3=size(i3,1)*100/10000 % % % i1a=find(z<1); i2a=find(z<2); i3a=find(z<3); p1a=size(i1a,1)*100/10000 p2a=size(i2a,1)*100/10000 p3a=size(i3a,1)*100/10000 % % % yc=normcdf(x,0,1); figure plot(x,yc) grid on xlabel('x') ylabel('c.d.f.') title('Standard normal distribution\prime s c.d.f.') % % % x1=[-3:0.5:3]; whos x1 % Name Size Bytes Class % % x1 1x13 104 double array % %Grand total is 13 elements using 104 bytes % for i=1:size(x1,2) yc1(i)=size(find(z