From 8ac15bc5efafa2afc053c293152605b0e6ae60ff Mon Sep 17 00:00:00 2001 From: Siddharth Agarwal Date: Tue, 3 Sep 2019 18:27:40 +0530 Subject: Xcos examples from textbooks and for blocks --- Working_Examples/215/CH2/EX2.1/ex2_1.sce | 35 ++++++++++++++++++++++++++++++++ Working_Examples/215/CH2/EX2.2/ex2_2.sce | 12 +++++++++++ Working_Examples/215/CH2/EX2.3/ex2_3.sce | 15 ++++++++++++++ Working_Examples/215/CH2/EX2.4/ex2_4.sce | 16 +++++++++++++++ 4 files changed, 78 insertions(+) create mode 100755 Working_Examples/215/CH2/EX2.1/ex2_1.sce create mode 100755 Working_Examples/215/CH2/EX2.2/ex2_2.sce create mode 100755 Working_Examples/215/CH2/EX2.3/ex2_3.sce create mode 100755 Working_Examples/215/CH2/EX2.4/ex2_4.sce (limited to 'Working_Examples/215/CH2') diff --git a/Working_Examples/215/CH2/EX2.1/ex2_1.sce b/Working_Examples/215/CH2/EX2.1/ex2_1.sce new file mode 100755 index 0000000..b6e0cfd --- /dev/null +++ b/Working_Examples/215/CH2/EX2.1/ex2_1.sce @@ -0,0 +1,35 @@ +//Example 2.1 +//Computation of power absorbed by each part +//From figure 2.13a +V=2;I=3; +//We have Power(P)=V*I +P=V*I +printf("a) Power =%dW\n",P) +if P>0 then + printf("Power is absorbed by the element\n") +else + printf("Power is supplied by the element\n"); +end + +clear P; +//From figure 2.13b +V=-2;I=-3; +//We have Power(P)=V*I +P=V*I +printf("b) Power =%dW\n",P) +if P>0 then + printf("Power is absorbed by the element\n") +else + printf("Power is supplied by the element\n") +end + +//From figure 2.13c +V=4;I=-5; +//We have Power(P)=V*I +P=V*I +printf("c) Power =%dW\n",P) +if P>0 then + printf("Power is absorbed by the element\n") +else + printf("Power is supplied by the element\n") +end diff --git a/Working_Examples/215/CH2/EX2.2/ex2_2.sce b/Working_Examples/215/CH2/EX2.2/ex2_2.sce new file mode 100755 index 0000000..3f56789 --- /dev/null +++ b/Working_Examples/215/CH2/EX2.2/ex2_2.sce @@ -0,0 +1,12 @@ +//Example 2.2 +//Calculate vL +disp("Given") +disp("v2=3V") +v2=3; +//From figure 2.19b +disp("Considering the right hand part of the circuit ") +disp("vL=5v2") +vL=5*v2; +disp("On substitution") +printf("vL=%dV\n",vL); + diff --git a/Working_Examples/215/CH2/EX2.3/ex2_3.sce b/Working_Examples/215/CH2/EX2.3/ex2_3.sce new file mode 100755 index 0000000..87a2176 --- /dev/null +++ b/Working_Examples/215/CH2/EX2.3/ex2_3.sce @@ -0,0 +1,15 @@ +//Example 2.3 +//Calculate the voltage and power dissipated acreoss the resistor terminals +//From figure 2.24b +disp("Given") +disp("R=560 ohm ; i=428mA") +R=560;i=428*10^-3; +//Voltage across a resistor is +disp("v=R*i") +v=R*i; +printf("Voltage across a resistor=%3.3fV\n",v) + +//Power dissipated by the resistor is +disp("p=v*i") +p=v*i; +printf("Power dissipated by the resistor=%3.3fW\n",p) diff --git a/Working_Examples/215/CH2/EX2.4/ex2_4.sce b/Working_Examples/215/CH2/EX2.4/ex2_4.sce new file mode 100755 index 0000000..6d0448e --- /dev/null +++ b/Working_Examples/215/CH2/EX2.4/ex2_4.sce @@ -0,0 +1,16 @@ +//Example 2.4 +//Calculate the power dissipated within the wire +//From figure 2.27 +disp("Given") +disp("Total length of the wire is 4000 feet") +disp("Current drawn by lamp is 100A") +//Considering American Wire Gauge system(AWG) +//Referring Table 2.4 +disp("4AWG=0.2485ohms/1000ft") +l=4000; i=100 ; rl=0.2485/1000; +//Let R be the wire resistance +R=l*rl; +//Let p be the power dissipated within the wire +disp("p=i^2*R") +p=i^2*R +printf("Power dissipated within the wire=%dW\n",p) -- cgit