summaryrefslogtreecommitdiff
path: root/2297/CH2/EX2.2/Ex2_2.sce
diff options
context:
space:
mode:
Diffstat (limited to '2297/CH2/EX2.2/Ex2_2.sce')
-rwxr-xr-x2297/CH2/EX2.2/Ex2_2.sce23
1 files changed, 23 insertions, 0 deletions
diff --git a/2297/CH2/EX2.2/Ex2_2.sce b/2297/CH2/EX2.2/Ex2_2.sce
new file mode 100755
index 000000000..3586610ac
--- /dev/null
+++ b/2297/CH2/EX2.2/Ex2_2.sce
@@ -0,0 +1,23 @@
+// Example 2.2 :current
+clc;
+close;
+clear;
+// given :
+vs1=72;//voltage in volts
+vs2=40;//voltage in volts
+R1=36;//resistance in ohm
+R2=10;//resistance in ohm
+ig=2;//current in amperes
+Rx=8;//resistance in ohm
+//(va-72)/36+(va-40)/10 -2 +va/8=0 node equation at 1
+va=((R2*Rx*vs1)+(R1*Rx*vs2)+(R1*R2*Rx*ig))/((R2*Rx)+(R1*Rx)+(R1*R2));//voltage in volts
+ix1=va/Rx;//current in amperes
+//(R1+R2)*I1-R2*I2+vs2=vs1 loop equation 1
+//R2*I2-R2*I1+Ix*Rx=vs2 loop equation 2
+//Ix=I2+2
+A=[R1+R2 -R2;-R2 R2+Rx];//making equations
+B=[vs1-vs2;vs2-2*Rx];//making equations
+X=A\B;//solving equations
+ix2=X(2,1)+ig;//current in amperes
+disp(ix1,"current through Rx is(by node voltage method), (A)=")
+disp(ix2,"current through Rx is (by loop current method),(A) =")