5.7 How to make contour plot of \(f(x,y)\) ?

Problem: Make contour of \(f(x,y)=(11-x-y)^2 + (1+x+10 y-xy)^2 \) over region \(0<x<20\) and \(0<y<10\).

Contour label placement seems to be better in Matlab. It is put in the middle of the line automatically.

Mathematica

f = (11 - x - y)^2 + (1 + x + 10 y - x y)^2; 
ContourPlot[f, {x, 0, 20}, {y, 0, 15}, 
 Contours -> 10, ContourShading -> None, 
 ContourLabels -> Function[{x, y, z}, 
   Text[z, {x, y}]], AspectRatio -> Automatic, 
   PlotRangePadding -> 2]
 

pict

 

Matlab

x = 0:0.05:20; 
y = 0:0.05:15; 
[x,y] = meshgrid(x,y); 
z = (11-x-y).^2 + (1+x+10*y-x.*y).^2; 
[C,h] =contour(x,y,z,10); 
clabel(C,h) 
title('Contours Labeled Using clabel(C,h)')
 

pict