What expression can I use in matlab to remove the negative component of a sine wave so it can look like the picture below?
I don't know MatLab but I suspect that (y + |y|)/2 (where |y| is the absolute value of the function) would do the trick.

When the function is positive the two halves add to give a regular sine. When the function is negative the function and absolute value cancel out.