If you are coughing up yellow gunk, that's pretty indicative of an infection. It is odd that you're not noticing a change in performance if that's the case. As for not maxing the HR, sometimes the first sign of infection is that your HR does not elevate during exercise the way it should.

I agree with Knott, it could be pneumonia.

If you're now coughing up clear stuff, that's an improvement. But you should rest until the gunk coughing up activity is resolved. If you continue to cough up yellow gunk or if it gets upgraded to green, you need to see a doc.

Maybe some of the other docs on the board can help with more info.