summaryrefslogtreecommitdiff
path: root/Working_Examples/154/CH2
diff options
context:
space:
mode:
authorSiddharth Agarwal2019-09-03 18:27:40 +0530
committerSiddharth Agarwal2019-09-03 18:27:40 +0530
commit8ac15bc5efafa2afc053c293152605b0e6ae60ff (patch)
treee1bc17aae137922b1ee990f17aae4a6cb15b7d87 /Working_Examples/154/CH2
parent52a477ec613900885e29c4a0b02806a415b4f83a (diff)
downloadXcos_block_examples-8ac15bc5efafa2afc053c293152605b0e6ae60ff.tar.gz
Xcos_block_examples-8ac15bc5efafa2afc053c293152605b0e6ae60ff.tar.bz2
Xcos_block_examples-8ac15bc5efafa2afc053c293152605b0e6ae60ff.zip
Xcos examples from textbooks and for blocksHEADmaster
Diffstat (limited to 'Working_Examples/154/CH2')
-rwxr-xr-xWorking_Examples/154/CH2/EX2.1/ch2_1.sce43
-rwxr-xr-xWorking_Examples/154/CH2/EX2.1/ch2_11.jpegbin0 -> 32334 bytes
-rwxr-xr-xWorking_Examples/154/CH2/EX2.2/ch2_2.sce41
-rwxr-xr-xWorking_Examples/154/CH2/EX2.2/ch2_21.jpegbin0 -> 35825 bytes
-rwxr-xr-xWorking_Examples/154/CH2/EX2.3/ch2_3.sce35
-rwxr-xr-xWorking_Examples/154/CH2/EX2.3/ch2_31.jpegbin0 -> 39165 bytes
-rwxr-xr-xWorking_Examples/154/CH2/EX2.4/ch2_4.sce17
-rwxr-xr-xWorking_Examples/154/CH2/EX2.5/ch2_5.sce29
8 files changed, 165 insertions, 0 deletions
diff --git a/Working_Examples/154/CH2/EX2.1/ch2_1.sce b/Working_Examples/154/CH2/EX2.1/ch2_1.sce
new file mode 100755
index 0000000..06689b4
--- /dev/null
+++ b/Working_Examples/154/CH2/EX2.1/ch2_1.sce
@@ -0,0 +1,43 @@
+
+disp("Example 2.1")
+printf("\n")
+printf("Given")
+disp("Resistance used is 4 ohm")
+disp("Current flow is i=2.5*sin(w*t)")
+disp("Angular frequency(w)=500 rad/s")
+
+R=4;
+iamp=2.5;w=500;
+t=0:0.001:0.012566
+i=2.5*sin(w*t)
+
+
+Vamp=iamp*R;
+printf("v=%d*sin(%d*t)(V)\n",Vamp,w)
+
+pamp=iamp*iamp*R;
+printf("p=%d(sin(%d*t))^2(W)\n",pamp,w)
+p=pamp*sin(w*t)^2;
+
+//On integrating p with respect to t
+W=25*(t/2-sin(2*w*t)/(4*w))
+
+function p=f(t),p=pamp*sin(w*t)^2,endfunction
+w1=intg(0,2*%pi/w,f);
+
+
+subplot(221)
+plot(t,i)
+xtitle ('i vs wt','wt','i ');
+
+subplot(222)
+plot(t,p)
+xtitle ('p vs wt','wt','p ');
+
+
+
+subplot(223)
+plot(t,W)
+xtitle ('w vs wt','wt','w ');
+
+
diff --git a/Working_Examples/154/CH2/EX2.1/ch2_11.jpeg b/Working_Examples/154/CH2/EX2.1/ch2_11.jpeg
new file mode 100755
index 0000000..edba37c
--- /dev/null
+++ b/Working_Examples/154/CH2/EX2.1/ch2_11.jpeg
Binary files differ
diff --git a/Working_Examples/154/CH2/EX2.2/ch2_2.sce b/Working_Examples/154/CH2/EX2.2/ch2_2.sce
new file mode 100755
index 0000000..8cfbb9a
--- /dev/null
+++ b/Working_Examples/154/CH2/EX2.2/ch2_2.sce
@@ -0,0 +1,41 @@
+clc
+disp("Example 2.2")
+printf("\n")
+printf("Given")
+disp("Inductance used is 30mH")
+disp("Current flow is i=10*sin(50*t)")
+L=30*10^-3;iamp=10;
+t=0:0.01:0.06283;
+i=10*sin(50*t)
+//v=L*d/dt(i)
+//d/dt(sin 50t)=50*cos t
+vamp=L*iamp*50;
+v=vamp*cos(50*t)
+
+//sinA*cosB=(sin(A+B)+sin(A-B))/2
+
+pamp=vamp*iamp/2;
+p=pamp*sin(100*t)
+//On integrating 'p' w.r.t t
+
+wL=0.75*(1-cos(100*t));
+
+
+subplot(221)
+plot(t,i)
+xtitle ('i vs wt','wt','i');
+
+subplot(222)
+plot(t,v)
+xtitle ('v vs wt','wt','v ');
+
+subplot(223)
+plot(t,p)
+xtitle ('p vs wt','wt','p ');
+
+subplot(224)
+plot(t,wL)
+xtitle ('wL vs wt','wt','wL ');
+
+
+
diff --git a/Working_Examples/154/CH2/EX2.2/ch2_21.jpeg b/Working_Examples/154/CH2/EX2.2/ch2_21.jpeg
new file mode 100755
index 0000000..e48aa65
--- /dev/null
+++ b/Working_Examples/154/CH2/EX2.2/ch2_21.jpeg
Binary files differ
diff --git a/Working_Examples/154/CH2/EX2.3/ch2_3.sce b/Working_Examples/154/CH2/EX2.3/ch2_3.sce
new file mode 100755
index 0000000..afff94c
--- /dev/null
+++ b/Working_Examples/154/CH2/EX2.3/ch2_3.sce
@@ -0,0 +1,35 @@
+clc
+disp("Example 2.3")
+printf("\n")
+printf("Given")
+disp("Capacitance used is 20uF")
+disp("Voltage is v=50*sin(200*t)")
+C=20*10^-6;
+// Given that v=50*sin(200*t);
+vamp=50;
+t=0:0.001:0.015;
+//q=C*v
+qamp=vamp*C
+q=qamp*sin(200*t)
+//i=C*d/dt(v)
+//d/dt(sin 200t)=200*cos t
+iamp=C*vamp*200;
+i=iamp*cos(200*t)
+
+//sinA*cosB=(sin(A+B)+sin(A-B))/2
+
+pamp=vamp*iamp/2;
+p=pamp*sin(400*t)
+
+//On integrating 'p' w.r.t t
+
+wC=12.5*(1-cos(400*t));
+
+figure
+a= gca ();
+plot(t,wC)
+xtitle ('wC vs wt','wt','wC (mJ)');
+a. thickness = 2;
+
+
+
diff --git a/Working_Examples/154/CH2/EX2.3/ch2_31.jpeg b/Working_Examples/154/CH2/EX2.3/ch2_31.jpeg
new file mode 100755
index 0000000..6b8ef67
--- /dev/null
+++ b/Working_Examples/154/CH2/EX2.3/ch2_31.jpeg
Binary files differ
diff --git a/Working_Examples/154/CH2/EX2.4/ch2_4.sce b/Working_Examples/154/CH2/EX2.4/ch2_4.sce
new file mode 100755
index 0000000..623b4b9
--- /dev/null
+++ b/Working_Examples/154/CH2/EX2.4/ch2_4.sce
@@ -0,0 +1,17 @@
+clc
+disp("Example 2.4")
+printf("\n")
+printf("Given")
+disp("Current through diode is 30mA")
+//From the table the nearest value is at v=0.74V
+V=0.74;I=28.7*10^-3;
+R=V/I;
+delV=0.75-0.73
+delI=42.7*10^-3-19.2*10^-3
+r=delV/delI
+p=(V*I)*10^3
+printf("\n \n Static resistance is %3.2fohm\n",R)
+printf("Dynamic resistance is %3.2fohm\n",r)
+printf("Power consumption is %3.2fmW\n",p)
+
+
diff --git a/Working_Examples/154/CH2/EX2.5/ch2_5.sce b/Working_Examples/154/CH2/EX2.5/ch2_5.sce
new file mode 100755
index 0000000..9d9c06c
--- /dev/null
+++ b/Working_Examples/154/CH2/EX2.5/ch2_5.sce
@@ -0,0 +1,29 @@
+clc
+disp("Example 2.5")
+printf("\n")
+printf("Given")
+disp("a)")
+disp("Current through diode is 10mA")
+//From the table the value is at v=2.5V
+V=2.5;I=10*10^-3;
+R=V/I;
+delV=3-2
+delI=11*10^-3-9*10^-3
+r=delV/delI
+p=(V*I)*10^3
+printf("\n \n Static resistance is %3.2fohm\n",R)
+printf("Dynamic resistance is %3.2fohm\n",r)
+printf("Power consumption is %3.2fmW\n",p)
+
+disp("b)")
+disp("Current through diode is 15mA")
+//From the table the value is at v=5V
+V=5;I=15*10^-3;
+R=V/I;
+delV=5.5-4.5
+delI=16*10^-3-14*10^-3
+r=delV/delI
+p=(V*I)*10^3
+printf("\n \n Static resistance is %3.2fohm\n",R)
+printf("Dynamic resistance is %3.2fohm\n",r)
+printf("Power consumption is %3.2fmW\n",p) \ No newline at end of file