From: Muhammad Khan on
I have three matrices, where N x 1 is the size of Matrices,

X=[N x 1]
Y= [N x 1]
V= [N x 1]

I want to plot contours of the matrix V on the X, Y grid.
I have read all the help and tried everything but without any success.
Main problem is in the help menu there is a condition that the matix
V should be a matrix with the size of N x N.

Please can anyone help me out on this. Is there any way that I can resolve this issue.

Regards
MM Khan
From: Wayne King on
"Muhammad Khan" <mahabat_khan(a)hotmail.com> wrote in message <hv4r4k$g65$1(a)fred.mathworks.com>...
> I have three matrices, where N x 1 is the size of Matrices,
>
> X=[N x 1]
> Y= [N x 1]
> V= [N x 1]
>
> I want to plot contours of the matrix V on the X, Y grid.
> I have read all the help and tried everything but without any success.
> Main problem is in the help menu there is a condition that the matix
> V should be a matrix with the size of N x N.
>
> Please can anyone help me out on this. Is there any way that I can resolve this issue.
>
> Regards
> MM Khan

Hi Muhammad, I take it from your post that V is a function of X and Y. Then V has to be NxN matrix. How did you obtain V? was V obtained empirically. and if so, then where are the measurements for the points (X,Y)? In other words, if X=1:N and Y=1:N then you should have measurements for V of the form (2,1), (1,2) (3,3) (1,4), (4,1) etc. That is why V has to be NxN.

You can use meshgrid to find V if you have a formula for V in terms of X and Y.

[X,Y] = meshgrid(-2:.2:2, -2:.2:2);
V = X .* exp(-X.^2 - Y.^2);
contour(X,Y,V);


Wayne