Initial release of Maemo 5 port of gnuplot
[gnuplot] / demo / electron.dem
1 #
2 # $Id: electron.dem,v 1.7.2.1 2007/08/12 18:37:10 sfeam Exp $
3 #
4 # Electronics demo
5 #
6 # Bipolar Transistor (NPN) Mutual Characteristic
7 Ie(Vbe)=Ies*exp(Vbe/kT_q)
8 Ic(Vbe)=alpha*Ie(Vbe)+Ico
9 alpha = 0.99
10 Ies = 4e-14
11 Ico = 1e-09
12 kT_q = 0.025
13 set dummy Vbe
14 set grid
15 set offsets
16 unset log
17 unset polar
18 set samples 160
19 set title "Mutual Characteristic of a Transistor"
20 set xlabel "Vbe (base emmitter voltage)"
21 set xrange [0 : 0.75]
22 set ylabel "Ic (collector current)"
23 set yrange [0 : 0.005]
24 set key box
25 set key at .2,.0045
26 set format y "%.4f"
27 plot Ic(Vbe)
28 set format "%g"
29
30 pause -1 "Hit return to continue"
31
32 # Junction Field Effect Transistor (JFET) Mutual Characteristic
33 # drain current above pinch off
34 Ida(Vd)=Ido*(1-Vg/Vp)**2
35 # drain current below pinch off
36 Idb(Vd)=Ido*(2*Vd*(Vg-Vp)-Vd*Vd)/(Vp*Vp)
37 # drain current
38 Id(Vd)= (Vd>Vg-Vp) ? Ida(Vd) : Idb(Vd)
39 # drain current at zero gate voltage
40 Ido = 2.5
41 # pinch off voltage
42 Vp = -1.25
43 # gate voltage
44 Vg = 0
45 set dummy Vd
46 unset grid
47 unset key
48 #set offsets 0, 1, 0, 0
49 set title "JFET Mutual Characteristic"
50 set xlabel "Drain voltage Vd (V)"
51 set xrange [0 : 4]
52 set ylabel "Drain current Id (mA)"
53 set yrange [0 : 5]
54 set label "-0.5 Vp" at 4.1,0.625
55 set label "-0.25 Vp" at 4.1,1.4
56 set label "0" at 4.1,2.5
57 set label "Vg = 0.5 Vp" at 4.1,3.9
58 plot Vg=0.5*Vp,Id(Vd),Vg=0.25*Vp,Id(Vd),Vg=0,Id(Vd),Vg=-0.25*Vp,Id(Vd)
59 unset label
60
61 pause -1 "Hit return to continue"
62
63 # show off double axes
64
65 # amplitude frequency response
66 A(jw) = ({0,1}*jw/({0,1}*jw+p1)) * (1/(1+{0,1}*jw/p2))
67 p1 = 10
68 p2 = 10000
69 set dummy jw
70 set grid x y2
71 set logscale xy
72 set log x2
73 unset log y2
74 set key default
75 set key bottom center box
76 set title "Amplitude and Phase Frequency Response"
77 set xlabel "jw (radians)"
78 set xrange [1.1 : 90000.0]
79 set x2range [1.1 : 90000.0]
80 set ylabel "magnitude of A(jw)"
81 set y2label "Phase of A(jw) (degrees)"
82 set ytics nomirror
83 set y2tics
84 set tics out
85 set autoscale  y
86 set autoscale y2
87 plot abs(A(jw)), 180/pi*arg(A(jw)) axes x2y2
88
89 pause -1 "Hit return to continue"
90
91 # undo what we've done
92 reset