From owner-help-octave at bevo dot che dot wisc dot edu Thu Nov 2 22:51:33 1995 Subject: mesh and meshdom bugs? From: Joao Cardoso To: help-octave at bevo dot che dot wisc dot edu Date: Fri, 3 Nov 1995 05:51:17 +0100 (MET) Hi, If I am correct, there is a bug in `meshdom' and `mesh'. In `meshdom' for some strange reason the y vector is calculated backward: y = y (ylen:-1:1); # jc: this line seems to be incorrect y = y (1:ylen); # jc: it should(?) be this way in `mesh', the following comparision also seems to be wrong: if (xlen == rows (z) && ylen == columns (z)) # wrong ? if (ylen == rows (z) && xlen == columns (z)) # right ? The following "code" tryes to show both problems. It is the `sombrero' ploted in the first quadrant. The first error message shows the error in `mesh'. Now, watching the plot, one can see that the maximum of the function in not at (0,0), showing the incorrection in `meshdom'. octave:1> n=5; x=linspace (0, 15, 5*n)';y=linspace (0,5, n)'; [xx, yy] = meshdom(x, y); r = sqrt (xx .^ 2 + yy .^ 2) + eps;z = sin (r) ./ r; mesh(x,y,z) error: mesh: rows (z) must be the same as length (x) and columns (z) must be the same as length (y) octave:2> n=5; x=linspace (0, 15, 5*n)';y=linspace (0,5, n)'; [xx, yy] = meshdom(x, y); r = sqrt (xx .^ 2 + yy .^ 2) + eps;z = sin (r) ./ r; mesh(x,y,z') <--- note the transposition of z, for this to work As I don't use this kind of ploting I am not absolutly shure of my reasons... Thanks, Joao