Matvec Users’ Guide
Matvec Users' Guide
Matvec Users' Guide
- No tags were found...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
50 CHAPTER 8. 2D/3D OBJECT-ORIENTED PLOTTING<br />
8.3.3 Example 3<br />
The following <strong>Matvec</strong> script draw the graph of normal pdf function for two sets of parameters.<br />
D1 = StatDist("Normal",0,1);<br />
D2 = StatDist("Normal",2,0.5);<br />
x = -4:4:0.1;<br />
xy1 = [x; D1.pdf(x)]’;<br />
xy2 = [x; D2.pdf(x)]’;<br />
xy1.save("Normal.dat1",1);<br />
xy2.save("Normal.dat2",1);<br />
curve1 = " ’Normal.dat1’ title ’N(0,1)’ with lines 1,";<br />
curve2 = " ’Normal.dat2’ title ’N(2,0.5)’ with lines 4";<br />
curve = curve1 + curve2;<br />
P = Plotter();<br />
P.set("nozeroaxis");<br />
P.set("size 4/5.0, 2.5/3.0")<br />
P.set("title ’Normal Probability Density Function (pdf)’ ");<br />
P.set("xlabel ’x’");<br />
P.set("ylabel ’pdf(x)’");<br />
P.set("key -2.0,0.5");<br />
P.plot(curve);<br />
The graph is shown on page 90.<br />
8.3.4 Example 4<br />
The following <strong>Matvec</strong> script draw the graph of the pdf of b(25, 0.15).<br />
D = StatDist("Binomial",25,0.15);<br />
x = -0.5:19.5;<br />
xy = [x; D.pdf([0:20])]’;<br />
xy.save("Binomial.dat",1);<br />
P = Plotter();<br />
P.set("title ’Binomial Probability Density Function (pdf)’ ");<br />
P.set("nozeroaxis");<br />
P.set("format y ’%3.2f’ ");<br />
P.set("xtics 0, 1.0, 13");<br />
P.set("xrange [-0.5 : 12.5]");<br />
P.set("size 4/5.0, 2.5/3.0")<br />
P.set("xlabel ’k’");<br />
P.set("ylabel ’pdf(k)’");<br />
P.plot(" ’Binomial.dat’ title ’b(25,0.15)’ with steps");<br />
The graph is shown on page 103.