How to draw contour lines (projections) on axis x or y with octave?

1.2k Views Asked by At

With the builtin function contour(x,y,z) of octave one can draw level curves where z remains constant.

My question is how to draw contour lines on axis x or axis y? The dataset I have is defined below:

function [ret] = wslb (u,v)
  z = 1.96;
  n = u + v;
  p = u / n;
  ret = (p + z*z/2/n - z * sqrt((p*(1-p)+z*z/4/n)/n))/(1+z*z/n);
endfunction

x = y = 0.1:0.5:10;
[xx,yy] = meshgrid(x,y);
z = arrayfun(@wslb,xx,yy);

mesh(x,y,z);
contour(x,y,z);

The plots look like:

Left: 3D plot, Right: Contour Lines on axis z

What I expect to get for axis x and axis y are like:

what i want to get

How can I achieve this?

1

There are 1 best solutions below

0
On BEST ANSWER

Probably more suited to SO, but these are the 3 contour commands you want (I haven't tested in Octave, but it should be fine).

contour(xx,yy,z)
contour(xx,z,yy)
contour(yy,z,xx)