x = randn(10000,1); hist(x) hist(x,20) xsrt = sort(x); plot(xsrt) plot([1:length(xsrt)],xsrt); plot(xsrt,[1:length(xsrt)]/length(xsrt)); hold Current plot held xsrt2 = xsrt(xsrt<1); whos Name Size Bytes Class Attributes x 10000x1 80000 double xsrt 10000x1 80000 double xsrt2 8440x1 67520 double plot(xsrt2,[1:length(xsrt2)]/length(xsrt2),'g'); xsrt3 = xsrt(xsrt<-1); plot(xsrt3,[1:length(xsrt3)]/length(xsrt3),'r'); x1 = randn(10000,1); x2 = exprnd(1,10000,1); xvec = [x1,x2]; whos Name Size Bytes Class Attributes x 10000x1 80000 double x1 10000x1 80000 double x2 10000x1 80000 double xsrt 10000x1 80000 double xsrt2 8440x1 67520 double xsrt3 1556x1 12448 double xvec 10000x2 160000 double mean(xvec) ans = -0.0020 1.0071 mean(xvec)' ans = -0.0020 1.0071 x = randn(1000,10; ??? x = randn(1000,10; | {Error: Unbalanced or unexpected parenthesis or bracket. } x = randn(1000,1); x1 = randn(1000,1); x2 = randn(1000,1); plot(x1,x2,'.'); plot(x1,x2,'.'); corrcoef([x1,x2]) ans = 1.0000 0.0005 0.0005 1.0000 cov([x1,x2]) ans = 0.9994 0.0004 0.0004 0.9317 x2 = randn(1000,1)*2; corrcoef([x1,x2]) ans = 1.0000 -0.0915 -0.0915 1.0000 cov([x1,x2]) ans = 0.9994 -0.1845 -0.1845 4.0685 x3 = x1+.0*randn(1000,1); plot(x1,x3,'.'); corrcoef([x1,x3]) ans = 1 1 1 1 x3 = x1+.1*randn(1000,1); plot(x1,x3,'.'); corrcoef([x1,x3]) ans = 1.0000 0.9951 0.9951 1.0000 x3 = x1+1*randn(1000,1); plot(x1,x3,'.'); corrcoef([x1,x3]) ans = 1.0000 0.7424 0.7424 1.0000 x3 = -x1+2*randn(1000,1); plot(x1,x3,'.'); corrcoef([x1,x3]) ans = 1.0000 -0.4716 -0.4716 1.0000 x = randn(1000,1); y = x.^2; plot(x,y) plot(x,y,'.') corrcoef([x,y]) ans = 1.0000 0.0144 0.0144 1.0000 y = x.^2+5*randn(1000,1); plot(x,y,'.') y = x.^2+1*randn(1000,1); plot(x,y,'.') corrcoef([x,y]) ans = 1.0000 -0.0034 -0.0034 1.0000 y = x.^2+x+1*randn(1000,1); plot(x,y,'.') corrcoef([x,y]) ans = 1.0000 0.5155 0.5155 1.0000 y = x.^2+x; plot(x,y,'.') corrcoef([x,y]) ans = 1.0000 0.5871 0.5871 1.0000 diary off