diff options
Diffstat (limited to '2459/CH21/EX21.8/Ex21_8.sce')
-rw-r--r-- | 2459/CH21/EX21.8/Ex21_8.sce | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/2459/CH21/EX21.8/Ex21_8.sce b/2459/CH21/EX21.8/Ex21_8.sce new file mode 100644 index 000000000..973855372 --- /dev/null +++ b/2459/CH21/EX21.8/Ex21_8.sce @@ -0,0 +1,35 @@ +//chapter21
+//example21.8
+//page473
+
+Rl=1d3 // ohm
+R=200 // ohm
+
+// for positive half cycle, diode is forward biased and since load is in parallel with diode we get
+V_out_p=0.7 // V
+
+// for negative half cycle, diode is reverse biased so it is open. Hence
+V_in=-10 // V
+V_out_n=V_in*Rl/(Rl+R)
+
+printf("output voltage for positive cycle = %.3f V \nand for negative cycle = %.3f V",V_out_p,V_out_n)
+
+// plotting input and output waveforms in same graph using following code instead of using xcos
+clf()
+t=linspace(0,%pi,100)
+Vin=V_in*sin(t)
+Vout=-V_out_n*sin(t)
+subplot(2,2,1)
+plot2d(t,-Vin,style=3,rect=[0,0,10,11])
+xtitle("Vin +ve","t","volts")
+subplot(2,2,2)
+plot2d(t,Vout,style=2,rect=[0,-5,10,0.7])
+xtitle("Vout","t","volts")
+t=linspace(%pi,2*%pi,100)
+Vin=V_in*sin(t)
+subplot(2,2,3)
+plot2d(t,-Vin,style=3,rect=[0,-11,10,0])
+xtitle("Vin -ve","t","volts")
+subplot(2,2,4)
+plot2d(t,-Vout,style=2,rect=[0,-11,10,0])
+xtitle("Vout","t","volts")
|