-2

Consider this example:

X = 0:0.01:1;
Y = 0:0.01:1;
[x,y] = meshgrid(X,Y);
z = sin(x.*y);
contourf(x,y,z,'ShowText','on')

enter image description here

The contour's values are determined automatically. How can I plot specifi contour lines with specific values like [0.1,0.3,0.44,0.63,0.78,0.89]?

MOON
  • 2,516
  • 4
  • 31
  • 49

1 Answers1

-3

If the desired values are

  v = [0.1,0.3,0.44,0.63,0.78,0.89]

then we have

X = 0:0.01:1;
Y = 0:0.01:1;
[x,y] = meshgrid(X,Y);
z = sin(x.*y);
contourf(x,y,z,[0.1,0.3,0.44,0.63,0.78,0.89],'ShowText','on')

the place of vector 'v' must be right after 'z'.

MOON
  • 2,516
  • 4
  • 31
  • 49