From: Snow White on
I have to plot a surface using 3d plotting. I have three vectors X,Y and N1

Sizeof X is 1 330
Sizeof Y is 1 320
Size of N1 is 330 320

i am trying meshgrid and surf but i get the following error:
surf(X,Y,N1)
??? Error using ==> surf at 70
Data dimensions must agree.
From: Sean on
"Snow White" <gulesaman(a)gmail.com> wrote in message <hrp381$o77$1(a)fred.mathworks.com>...
> I have to plot a surface using 3d plotting. I have three vectors X,Y and N1
>
> Sizeof X is 1 330
> Sizeof Y is 1 320
> Size of N1 is 330 320
>
> i am trying meshgrid and surf but i get the following error:
> surf(X,Y,N1)
> ??? Error using ==> surf at 70
> Data dimensions must agree.

x = 1:330;
y = 1:320;
N1 = rand(330,320);
[xx yy] = ndgrid(x,y);
surf(xx,yy,N1);

Here is an excerpt form the help of ndgrid:
NDGRID is like MESHGRID except that the order of the first two input
arguments are switched (i.e., [X1,X2,X3] = NDGRID(x1,x2,x3) produces
the same result as [X2,X1,X3] = MESHGRID(x2,x1,x3)). Because of
this, NDGRID is better suited to N-D problems that aren't spatially
based, while MESHGRID is better suited to problems in cartesian
space (2-D or 3-D).
From: Wayne King on
"Snow White" <gulesaman(a)gmail.com> wrote in message <hrp381$o77$1(a)fred.mathworks.com>...
> I have to plot a surface using 3d plotting. I have three vectors X,Y and N1
>
> Sizeof X is 1 330
> Sizeof Y is 1 320
> Size of N1 is 330 320
>
> i am trying meshgrid and surf but i get the following error:
> surf(X,Y,N1)
> ??? Error using ==> surf at 70
> Data dimensions must agree.

Hi, your 'X' vector has to match the size of N1 in along the column dimension. Your 'Y' vector has to match the size of N1 along the row dimension.

surf(X,Y,N1');

or swap your X and Y.

Wayne
From: Snow White on
thank you

"Wayne King" <wmkingty(a)gmail.com> wrote in message <hrp4dh$dov$1(a)fred.mathworks.com>...
> "Snow White" <gulesaman(a)gmail.com> wrote in message <hrp381$o77$1(a)fred.mathworks.com>...
> > I have to plot a surface using 3d plotting. I have three vectors X,Y and N1
> >
> > Sizeof X is 1 330
> > Sizeof Y is 1 320
> > Size of N1 is 330 320
> >
> > i am trying meshgrid and surf but i get the following error:
> > surf(X,Y,N1)
> > ??? Error using ==> surf at 70
> > Data dimensions must agree.
>
> Hi, your 'X' vector has to match the size of N1 in along the column dimension. Your 'Y' vector has to match the size of N1 along the row dimension.
>
> surf(X,Y,N1');
>
> or swap your X and Y.
>
> Wayne
From: Luigi Giaccari on
"Snow White" <gulesaman(a)gmail.com> wrote in message <hrp381$o77$1(a)fred.mathworks.com>...
> I have to plot a surface using 3d plotting. I have three vectors X,Y and N1
>
> Sizeof X is 1 330
> Sizeof Y is 1 320
> Size of N1 is 330 320
>
> i am trying meshgrid and surf but i get the following error:
> surf(X,Y,N1)
> ??? Error using ==> surf at 70
> Data dimensions must agree.


I hope one of these works

http://www.mathworks.com/matlabcentral/newsreader/create_message?reply_id=711429

http://www.advancedmcode.org/how-to-plot-a-coloured-surface-from-3d-scatter.html

http://www.advancedmcode.org/surface-recostruction-from-scattered-points-cloud-mycrustopen.html

http://www.advancedmcode.org/surface-recostruction-from-scattered-points-cloud-mycrust-robust.html



http://www.advancedmcode.org
 | 
Pages: 1
Prev: Problem with nlinfit
Next: problam in matlab