summaryrefslogtreecommitdiff
path: root/3507/CH21/EX21.6
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /3507/CH21/EX21.6
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '3507/CH21/EX21.6')
-rw-r--r--3507/CH21/EX21.6/Ex21_6.sce20
1 files changed, 20 insertions, 0 deletions
diff --git a/3507/CH21/EX21.6/Ex21_6.sce b/3507/CH21/EX21.6/Ex21_6.sce
new file mode 100644
index 000000000..a3200f544
--- /dev/null
+++ b/3507/CH21/EX21.6/Ex21_6.sce
@@ -0,0 +1,20 @@
+//chapter21
+//example21.6
+//page472
+
+Rl=4 // kilo ohm
+R=1 // kilo ohm
+Vin_peak=10 // V
+
+Vout_peak=Vin_peak*Rl/(Rl+R)
+Vout_min=0 // because of diode
+printf("peak output voltage = %.3f V \n",Vout_peak)
+
+// plotting input and output waveforms in same graph using following code instead of using xcos
+clf()
+t=linspace(0,2*%pi,100)
+Vin=Vin_peak*sin(t)
+Vout=Vout_peak*sin(t)+Vout_min
+plot2d(t,Vin,style=2,rect=[0,0,10,20])
+xtitle("input - blue output - green","t","volts")
+plot2d(t,Vout,style=3,rect=[0,0,10,20])