The average is 2,5V on the resistor, after the diode. If the duration of the positive voltage is: T1, then in general, the average on the resistor, after the diode would be: Vm*T1/T . If T1=T/2 then Vaver=5/2=2,5V. T is the period of the square wave.
In the case 2, Vaver=7*1/2=3,5V