I need to take the integral of the following function over one cycle.

y(t) = sin(w*t)*cos(w*t-p)

p is a phase angle that exist from 0 to pi. w is a frequency.

This would be pretty straightforward, but I need to take the integral only of the portions of the function that are greater than zero.

I need to do this for an efficiency analysis, where the negative portion of the cycle is waste energy and don't contribute to average power. I need an symbolic expression.

The zero crossings are at t1 = pi/w and t2 = pi/(2w) + p/w which I had been using as limits of integration.

t1________t2

int y(t) dt - int y(t) dt

0________ t1

(the underscores are just to get the limits of integration lined up)

The resulting expression is correct for values of for 0<=p <= pi/2. Above p = pi/2 though, the expression does not give me the result I need, because for p> pi/2, t2<t1 and the result of

t2

int y(t) dt

t1

becomes negative.

I am not sure how to get around this. Any help would be...helpful. Thanks!