blob: e8aa2ff760d5a8b02eba044b2a453e05d204b858 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
clear//
//Variables
V1 = -2.0 //Voltage (in volts)
V2 = 2.0 //Voltage (in volts)
V3 = -1.0 //Voltage (in volts)
R1 = 200.0 * 10**3 //Resistance (in ohm)
R2 = 250.0 * 10**3 //Resistance (in ohm)
R3 = 500.0 * 10**3 //Resistance (in ohm)
Rf = 1.0 * 10**6 //Resistance (in ohm)
//Calculation
Vout = (-Rf/R1*V1) + (-Rf/R2*V2) + (-Rf/R3*V3) //Output voltage (in volts)
//Result
printf("\n Output voltage is %0.3f V.",Vout)
|