summaryrefslogtreecommitdiff
path: root/147/CH1/EX1.7/Example1_7.sce
blob: dc8176855e826cd5fed23ad4a344e493f8e7a8df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
close();
clear;
clc;
//resistance 'R1', 'R2', 'R3', 'R4' connected in series
V = 100; //V
R1 = 5; //ohm
R2 = 10; //ohm
R3 = 15; //ohm
R4 = 20; //ohm
//Voltage across R1 'V1'
V1 = R1*V/(R1+R2+R3+R4);
//Voltage across R2 'V2'
V2 = R2*V/(R1+R2+R3+R4);
//Voltage across R3 'V3'
V3 = R3*V/(R1+R2+R3+R4);
//Voltage across R4 'V4'
V4 = R4*V/(R1+R2+R3+R4);
mprintf("\nVoltage across %d ohm resistor is %d V\nVoltage across %d ohm resistor is %d V\nVoltage across %d ohm resistor is %d V\nVoltage across %d ohm resistor is %d V",R1,V1,R2,V2,R3,V3,R4,V4);