From: Lim Sim Yee on
How can i determine the highest point in the filled contour and mark it with red 'x'?
I tried using max but resulted in error message.

load('0101862_mod.dtm') % loading the dtm file
X = X0101862_mod(1:81,:) % we name X0101862, it is the location where the data X, Y and Z is stored
Y = X0101862_mod(82:162,:)
Z = X0101862_mod (163:243,:)

figure (1)
subplot(2,2,3)
[C,h] = contourf(X,Y,Z,10);
xlabel('x'); ylabel('y'); zlabel('z'); title('X0101862_mod');
view(-73,34); axis equal; colormap summer; colorbar;
From: Ross W on
"Lim Sim Yee" <cherry90_mugsycat(a)hotmail.com> wrote in message <i33bg1$k4$1(a)fred.mathworks.com>...
> How can i determine the highest point in the filled contour and mark it with red 'x'?
> I tried using max but resulted in error message.
>
> load('0101862_mod.dtm') % loading the dtm file
> X = X0101862_mod(1:81,:) % we name X0101862, it is the location where the data X, Y and Z is stored
> Y = X0101862_mod(82:162,:)
> Z = X0101862_mod (163:243,:)
>
> figure (1)
> subplot(2,2,3)
> [C,h] = contourf(X,Y,Z,10);
> xlabel('x'); ylabel('y'); zlabel('z'); title('X0101862_mod');
> view(-73,34); axis equal; colormap summer; colorbar;

Hi

If you show us the code you used, and the error message, we might be able to help.

Ross
From: Lim Sim Yee on
Hi Ross, this is the codes in my m file.

%File: lab07_2.m

load('0101862_mod.dtm') % loading the dtm file
X = X0101862_mod(1:81,:) % we name X0101862, it is the location where the data X, Y and Z is stored
Y = X0101862_mod(82:162,:)
Z = X0101862_mod (163:243,:)

figure (1)

subplot(2,2,1)
surf(X,Y,Z);
xlabel('x'); ylabel('y'); zlabel('z'); title('X0101862_mod');
colorbar; colormap summer; grid on;
view(-73,34);

subplot(2,2,2)
[C,h] = contour(X,Y,Z,8); colorbar; colormap summer; clabel(C,h);
xlabel('x'); ylabel('y'); zlabel('z'); title('X0101862_mod');
view(-73,34); axis equal;

subplot(2,2,3)
[C,h] = contourf(X,Y,Z,10);
xlabel('x'); ylabel('y'); zlabel('z'); title('X0101862_mod');
view(-73,34); axis equal; colormap summer; colorbar;
M = max([C,h]);
plot(M, 'color' , 'rx')

subplot(2,2,4)
[DX, DY]=gradient(Z)
Xt=X(1:4:81,1:4:81);
Yt=Y(1:4:81,1:4:81);
DX=X(1:4:81,1:4:81);
DY=Y(1:4:81,1:4:81);
contourf(X,Y,Z,10); hold on; quiver(Xt,Yt,DX,DY);hold off;
xlabel('x'); ylabel('y'); zlabel('z'); title('X0101862_mod');
axis equal; colormap summer; colorbar;



got this error.
??? Error using ==> horzcat
CAT arguments dimensions are not consistent.

Error in ==> lab07_2 at 25
M = max([C,h]);
From: Walter Roberson on
Lim Sim Yee wrote:

> [C,h] = contourf(X,Y,Z,10);

> M = max([C,h]);

> got this error.
> ??? Error using ==> horzcat
> CAT arguments dimensions are not consistent.

Describe in words what the C and h return values from contourf
represent. What size is each of them expected to be? Are they expected
to have the same number of rows such that [C,h] would be computationally
valid? Considering what you want to find out, is it necessary to examine
the values in both? max() by default finds the maximum of each column:
is that what you want to do?

Are you trying to find the maximum contour level, or are you trying to
find the peak value? If you are trying to find the peak value, would it
not make more sense to examine the Z values directly instead of the
results of contouring ?
From: Lim Sim Yee on
> Describe in words what the C and h return values from contourf
> represent. What size is each of them expected to be? Are they expected
> to have the same number of rows such that [C,h] would be computationally
> valid? Considering what you want to find out, is it necessary to examine
> the values in both? max() by default finds the maximum of each column:
> is that what you want to do?

The loaded data will be an array of 243-by-81 matrix. It is separated to to 81x81 square matrices. the first matrix which is X is called from row 1 to row 82, second matrix Y is called from row 82 to 162 and the remaining rows is Z.

>
> Are you trying to find the maximum contour level, or are you trying to
> find the peak value? If you are trying to find the peak value, would it
> not make more sense to examine the Z values directly instead of the
> results of contouring ?

I am required to plot a filled contour plot of the data with 10 level. The data are X, Y and Z.
And then find the highest point in the contour and mark it with a red 'x' in the filled-contour plot.
My tutor said it involves 'max' command. Its not peak.