summaryrefslogtreecommitdiff
path: root/671/CH2/EX2.1/2_1.sce
blob: 03bbb420294a8c7fd61a2bf2050bbc7c09842373 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function s=series(r1,r2)
    s=r1+r2
endfunction

function p=parallel(r1,r2)
    p=r1*r2/(r1+r2)
endfunction

r1=series(12,8)
r2=parallel(20,r1)
r3=series(r2,50)
r4=parallel(30,r3)
r5=series(10,r4)
r6=series(r5,20)
Req_ab=parallel(r5,40)
disp(Req_ab)

r7=40+20+10  //series
Req_bc=parallel(r4,r7)
disp(Req_bc)