You are on page 1of 4

Electric Circuits - I

Electrical Engineering Department


Jordan University of Science and Technology
Homework # 1 due Next Sunday 2020.02.16
February 11, 2020

1. In problem AS6ec2p35 on page 69 find the branch currents i1 , i2 , i3 and the voltage Vo . Also find the power
dissipated in the resistor R12 .

i2

R12 R13

V10 +
− 2 3
Io
i
+ 3
i1 R20 Vo R30

as6ec2p35.m4
0

If your ID number=N, then take R12 = 1 + N mod 31Ω, R13 = 1 + N mod 17Ω, R20 = 1 + N mod 41Ω,
R30 = 1 + N mod 43Ω, and V10 = 1 + N mod 23V .

Solution: Three solutions: 1- using iterative method (MatLab and Octave)


% a s 6 e c 2 p 3 5 .m: t h i s s o l u t i o n u s e s i t e r a t i v e method
clear
clc
% u i s t h e v e c t o r o f unknowns .
%k v l 1 : −V10+R12 ∗ ( I1−I 2 )+R20 ∗ ( I1−I 3 )= r h s ( 1 ) ;
%k v l 2 : R12 ∗ ( I2−I 1 )+R13∗ I 2=r h s ( 2 ) ;
%k v l 3 : R20 ∗ ( I3−I 1 )+R30∗ I 3=r h s ( 3 ) ;
clear
% R12=15; R20=20; R13=30; R30=5; V10=200;
N=99999;
R12=1+mod(N, 3 1 ) ; R13=1+mod(N, 1 7 ) ; R20=1+mod(N, 4 1 ) ;
R30=1+mod(N, 4 3 ) ; V10=1+mod(N, 2 3 ) ;
% Here u=[ I 1 ; I 2 ; I 3 ]
r h s=@( u ) [−V10+R12 ∗ ( u(1) −u (2))+ R20 ∗ ( u(1) −u ( 3 ) ) ;
R12 ∗ ( u(2) −u (1))+ R13∗u ( 2 ) ;
R20 ∗ ( u(3) −u (1))+ R30∗u ( 3 ) ] ;

[ u , f v a l , i n f o ]= f s o l v e ( rhs , [ − 1 , 1 , 1 ] ) ;
t=n u m 2 c e l l ( u ) ;
[ I1 , I2 , I 3 ]= d e a l ( t { : } )

I o=I3−I 2

1
2 EE210

Vo=I 3 ∗R30
PR12=(I1−I 2 ) ˆ 2 ∗ R12
%{
Answers :
I1 = 3.2757
I2 = 2.6417
I3 = 0.1260
Io = −2.5157
Vo = 3.1497
PR12 = 10.0492
%}

2- using Ax=b (MatLab and Octave)


% as6ec2p35Ab .m: t h i s s o l u t i o n u s e s Ax=b
clear
clc
clear
N=99999;
R12=1+mod(N, 3 1 ) ; R13=1+mod(N, 1 7 ) ; R20=1+mod(N, 4 1 ) ;
R30=1+mod(N, 4 3 ) ; V10=1+mod(N, 2 3 ) ;
%k v l 1 : −V10+R12 ∗ ( I1−I 2 )+R20 ∗ ( I1−I 3 )=0;
%k v l 2 : R12 ∗ ( I2−I 1 )+R13∗ I 2 =0;
%k v l 3 : R20 ∗ ( I3−I 1 )+R30∗ I 3 =0;
A=[R12+R20 , −R12 , −R20 ; −R12 , R12+R13 , 0 ; −R20 , 0 , R20+R30 ]
b=[V10 ; 0 ; 0 ]
I=i n v (A) ∗ b % o r I=A\b
I o=I (3) − I ( 2 )
Vo=I ( 3 ) ∗ R30
PR12=( I (1) − I ( 2 ) ) ˆ 2 ∗ R12
%{
Answers :
I1 = 3.2757
I2 = 2.6417
I3 = 0.1260
Io = −2.5157
Vo = 3.1497
PR12 = 10.0492
%}

3- using MatLab Symbolic Toolbox (MatLab only)


% a s 6 e c 2 p 3 5 x .m t h i s s o l u t i o n u s e s MatLab Symbolic Toolbox
N=99999;
R12=1+mod(N, 3 1 ) ; R13=1+mod(N, 1 7 ) ; R20=1+mod(N, 4 1 ) ;
R30=1+mod(N, 4 3 ) ; V10=1+mod(N, 2 3 ) ;
syms I 1 I 2 I 3
k v l 1= −V10+R12 ∗ ( I1−I 2 )+R20 ∗ ( I1−I 3 )==0;
k v l 2= R12 ∗ ( I2−I 1 )+R13∗ I 2 ==0;
k v l 3= R20 ∗ ( I3−I 1 )+R30∗ I 3 ==0;

[ A, b]= e q u a t i o n s T o M a t r i x ( [ kvl1 , kvl2 , k v l 3 ] , [ I1 , I2 , I 3 ] ) ;


I=d o u b l e (A\b )
I o=d o u b l e ( I (3) − I ( 2 ) )
Vo=d o u b l e ( I ( 3 ) ∗ R30 )
PR12=d o u b l e ( ( I (1) − I ( 2 ) ) ˆ 2 ∗ R12 )
%{
Answers :
I (1)= 3.2757
I (2)= 2.6417
I (3)= 0.1260
I o = −2.5157
Vo = 3 . 1 4 9 7
Abdel-Rahman Jaradat 3

PR12=10.0492
%}

2. Use LTSpice to solve the previous question.


Hint: replace the wire connecting nodes 2 and 3 by a small resistor Rx = 1uΩ.
Rx 2 3 1u

Solution:
∗ C: \ t e a c h \ e e 2 1 0 \ s p i c e \ a s 6 e c 2 p 3 5 . sp
. param N=99999
. func mod(N,m) {N−f l o o r (N/m) ∗m}
. param R12={1+mod(N, 3 1 ) } , R20={1+mod(N, 4 1 ) } , R13={1+mod(N, 1 7 ) } , R30={1+mod(N, 4 3 ) }
. param v10={1+mod(N, 3 1 ) }
v10 1 0 DC {1+mod(N, 2 3 ) }
R12 1 2 {R12}
R20 2 0 {R20}
Rx 2 3 1u
R13 1 3 {R13}
R30 3 0 {R30}

. op
. meas Io param I (Rx)
. meas V0 param V( 3 )
. meas PR12 param ( v(1) −v ( 2 ) ) ∗ I ( R12 )
. meas R12m param R12
. meas R20m param R20
. meas R13m param R13
. meas R30m param R30
. meas v10m param v10
. end
−−− O p e r a t i n g P oi nt −−−

V( 1 ) : 19 voltage
V( 2 ) : 3.14973 voltage
V( 3 ) : 3.14973 voltage
I ( R30 ) : 0.125989 device current
I ( R13 ) : 2.64171 device current
I (Rx ) : −2.51572 device current
I ( R20 ) : 3.14973 device current
I ( R12 ) : 0.634011 device current
I ( V10 ) : −3.27572 device current

; . meas :
i o : i ( rx )= −2.51572
v0 : v ( 3 ) = 3 . 1 4 9 7 3
pr12 : ( v(1) −v ( 2 ) ) ∗ i ( r 1 2 )=10.0492

3. There are three meshes in the circuit below having mesh currents i1 , i2 , i3 as shown in the circuit below. Write
down the three mesh equations and solve them to find the values of the mesh currents and for vx .
Find out the power generated by the voltage source and the power dissipated in R6 .
If your ID number=N, then take R1 = 1+N mod 31Ω, R2 = 1+N mod 17Ω, R3 = 1+N mod 41Ω, R4 = 1+N
mod 43Ω, R5 = 1 + N mod 11Ω, R6 = 1 + N mod 13Ω, and Vs = 1 + N mod23V .
4 EE210

R4 5 R5
i2 i3
+
1 i1 R1 2 4
vx R6

V10 +
− R2 3 R3

as6ec2p72.m4
0

Solution:

4. Use LTSpice to solve the previous question. Submit the .sp file and the output produced by LTSpice. Don’t forget
to write your Name and university ID on the first line of the ’.sp’ file.
Copy both the .sp file and the output of the simulation to a text document and print it.

Solution:

5. Use MatLab/Octave to solve the previous question. Submit the .m file and the output from the MatLab/Octave.
Don’t forget to write your Name and university ID on the first line of the ’.m’ file.
Copy both the .m file and the output of the simulation to a text document and print it.

Solution:

You might also like