summaryrefslogtreecommitdiff
path: root/3556/CH2/EX2.2/Ex2_2.sce
blob: 42547334067766faf23c52de98bac8d3bd3a7806 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
clc
// Fundamental of Electric Circuit 
// Charles K. Alexander and  Matthew N.O Sadiku  
// Mc Graw Hill of New York 
// 5th Edition 

// Part 1   :  DC Circuits 
// Chapter 2:  Basic Laws 
// Example 2 - 2

clear; clc; close; 
//
// Given data
v  =   30.00; 
R  = 5000.00; 
//
// Calculations Current  
i = v/R;      
// Calculations Conductance 
G = 1/R; 
// Calculation Power p1
p1 = v*i;          
// Calculation Power p2  - Various Way 
p2 = (i^2)*R;      
// Calculation Power p3  - Various Way 
p3 = (v^2)*G;      
//
// Display the result
disp("Example 2-2 Solution : ");
printf(" \n i  : Current = %.3f A ", i);
printf(" \n P  : Power   = %.3f Watt",p1);
printf(" \n P  : Power   = %.3f Watt ",p2);
printf(" \n P  : Power   = %.3f Watt ",p3);
// 
disp("Another Solution     : ");
printf(" \n i  : Current = %.3f mA ", i*1000);
printf(" \n P  : Power   = %.3f mWatt",p1*1000);
printf(" \n P  : Power   = %.3f mWatt ",p2*1000);
printf(" \n P  : Power   = %.3f mWatt ",p3*1000);