diff options
Diffstat (limited to 'Working_Examples/215/CH2/EX2.1/ex2_1.sce')
-rwxr-xr-x | Working_Examples/215/CH2/EX2.1/ex2_1.sce | 35 |
1 files changed, 35 insertions, 0 deletions
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
|