I could not figure how to calculate the average of a square wave.
Consider a square wave of +5V from time 0 to 6 sec and -3V from 6 to 10 sec.
On integrating from time 0 to 6 the average: 3.0V
On integrating from time 6 to 10 the average: -1.2V
Thus the total average is : $$3-1.2=1.8V$$
But according to my teacher it results in 4.2V (3 +1.2).
Can anyone explain me the calculation?