diff options
Diffstat (limited to '1445/CH1/EX1.33/ch1_ex_33.sce')
-rw-r--r-- | 1445/CH1/EX1.33/ch1_ex_33.sce | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/1445/CH1/EX1.33/ch1_ex_33.sce b/1445/CH1/EX1.33/ch1_ex_33.sce new file mode 100644 index 000000000..35f0b1417 --- /dev/null +++ b/1445/CH1/EX1.33/ch1_ex_33.sce @@ -0,0 +1,33 @@ +//CHAPTER 1- D.C. CIRCUIT ANALYSIS AND NETWORK THEOREMS +//Example 33 + +disp("CHAPTER 1"); +disp("EXAMPLE 33"); + +//VARIABLE INITIALIZATION +I=10; //current source in Amperes +v=10; //voltage source in Volts +r1=4; //top resistance in Ohms +r1=4; //right resistance in Ohms +r3=4; //bottom resistance in Ohms +r4=6; //left resistance in Ohms +r5=1; //in Ohms + +//SOLUTION +//(17)v1+(-12)v2=150.......eq (1) +//(-4)v1+(6)v2=10..........eq (2) +//solving the equations by matrix method +A=[17 -12;-4 6]; +b=[150;10]; +x=inv(A)*b; +v1=x(1,:); //to access the 1st element of 2X1 matrix +v2=x(2,:); //to access the 1st element of 2X1 matrix +if(v1>v2) then +I=(v1-v2)/r5; +disp(sprintf("By Nodal analysis, the current through 1Ω resistor is %f A",I)); +else +I=(v2-v1)/r5; +disp(sprintf("By Nodal analysis, the current through 1Ω resistor is %f A",I)); +end; + +//END |