octave> m=readpgm('mars.pgm'); magic number = P2 rows = 383 cols = 279 grey levels = 255 octave> mh=histogram(m,256); octave> mp=mh/sum(mh); octave> plot(0:255,mp);
octave> mc=cdf(mp); # you write cdf octave> plot(0:255,mc);
octave> mi=icdf(mp,1000); # you write icdf octave> plot((1:1000)/1000,mi);
octave> p=exp(-(0:255).^2/1000); octave> p=p/sum(p); octave> b=rand2(p,64); # you write rand2 octave> bh=histogram(b,256) octave> bp=bh/sum(bh); octave> mplot(0:255,p,0:255,bp);