Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- close all
- clear all
- T = 10000;
- mu =2 ;
- sigma = 0.4 ;
- x = (randn(T,1)* sigma) +mu ; %% X distributed (mean = mu and std = sigma)
- Z = (x -mu)./sigma ;
- xPos = 1.5;
- figure
- subplot(4,2,1)
- hist(x)
- title('a) X')
- subplot(4,2,2)
- hist(Z)
- title('b) Z')
- subplot(4,2,3)
- xsort = sort(x);
- PDF_X = normpdf(xsort,mu,sigma );
- plot(xsort,PDF_X)
- title(strcat('c) pdf(X), integral =',num2str( trapz(xsort,PDF_X))))
- hold on
- y1=get(gca,'ylim');
- plot([xPos xPos],y1);
- hold off
- subplot(4,2,4)
- zsort = sort(Z);
- PDF_Z = normpdf(zsort,0,1 );
- plot(zsort,PDF_Z)
- title(strcat('d) pdf(Z), integral =',num2str(trapz(zsort,PDF_Z))))
- hold on
- y1=get(gca,'ylim');
- plot([xPos xPos],y1);
- hold off
- subplot(4,2,5)
- plot(xsort,PDF_Z)
- title(strcat('e) pdf(Z) wrong domain, integral =',num2str(trapz(xsort,PDF_Z))))
- hold on
- y1=get(gca,'ylim');
- plot([xPos xPos],y1);
- hold off
- subplot(4,2,7)
- PDF3 = PDF_Z./sigma ;
- plot(xsort,PDF3)
- title(strcat('f) pdf(Z)/sigma, integral =',num2str(trapz(xsort,PDF3))))
- hold on
- y1=get(gca,'ylim');
- plot([xPos xPos],y1);
- hold off
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement