Contour Value

I have used matching square to draw contour plot but when I calculate contour value, I used f(x,y)=(XX+YY+aa)(XX+YY+aa)-4aaXX-bbbb, where a and b are constant values. Based on this calculation, I always get Ovals since this equation is Ovals of Cassini function. I am wondering if anyone knows that if there is a general equation which can be used to do general calculation so that when contour plot is draw, it will represent real data. any suggestion will be really appreciated.