Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
3d Rectangualr Grid

Subject: 3d Rectangualr Grid

From: Piya

Date: 26 Jan, 2010 09:47:03

Message: 1 of 12

Anyone have idea how to do this in Matlab?

Subject: 3d Rectangualr Grid

From: Per Sundqvist

Date: 26 Jan, 2010 11:37:03

Message: 2 of 12

"Piya " <priya.biomath@gmail.com> wrote in message <hjmdmn$rab$1@fred.mathworks.com>...
> Anyone have idea how to do this in Matlab?

try:
help ndgrid

/Per

Subject: 3d Rectangualr Grid

From: Priya

Date: 26 Jan, 2010 11:53:03

Message: 3 of 12

"Per Sundqvist" <per.sundqvist@live.com> wrote in message <hjmk4v$hdp$1@fred.mathworks.com>...
> "Piya " <priya.biomath@gmail.com> wrote in message <hjmdmn$rab$1@fred.mathworks.com>...
> > Anyone have idea how to do this in Matlab?
>
> try:
> help ndgrid
>
> /Per

Thanks for command but for a learner it is not enough. I need a close cylinder with 3d rectangular grid for flow analysis using finite volume method.

Subject: 3d Rectangualr Grid

From: Per Sundqvist

Date: 26 Jan, 2010 13:17:05

Message: 4 of 12

"Priya " <priya.biomath@gmail.com> wrote in message <hjml2v$h9n$1@fred.mathworks.com>...
> "Per Sundqvist" <per.sundqvist@live.com> wrote in message <hjmk4v$hdp$1@fred.mathworks.com>...
> > "Piya " <priya.biomath@gmail.com> wrote in message <hjmdmn$rab$1@fred.mathworks.com>...
> > > Anyone have idea how to do this in Matlab?
> >
> > try:
> > help ndgrid
> >
> > /Per
>
> Thanks for command but for a learner it is not enough. I need a close cylinder with 3d rectangular grid for flow analysis using finite volume method.

What about:

xmin=0;xmax=1;Nx=10;
xvec=linspace(xmin,xmax,Nx);
yvec=xvec;zvec=5*xvec; %change here
[x,y,z] = ndgrid(xvec,yvec,zvec);
plot3(x(:),y(:),z(:),'.');axis equal;

x(2,3,5)

Subject: 3d Rectangualr Grid

From: Priya

Date: 26 Jan, 2010 14:54:04

Message: 5 of 12

"Per Sundqvist" <per.sundqvist@live.com> wrote in message <hjmq0h$6tg$1@fred.mathworks.com>...
> "Priya " <priya.biomath@gmail.com> wrote in message <hjml2v$h9n$1@fred.mathworks.com>...
> > "Per Sundqvist" <per.sundqvist@live.com> wrote in message <hjmk4v$hdp$1@fred.mathworks.com>...
> > > "Piya " <priya.biomath@gmail.com> wrote in message <hjmdmn$rab$1@fred.mathworks.com>...
> > > > Anyone have idea how to do this in Matlab?
> > >
> > > try:
> > > help ndgrid
> > >
> > > /Per
> >
> > Thanks for command but for a learner it is not enough. I need a close cylinder with 3d rectangular grid for flow analysis using finite volume method.
>
> What about:
>
> xmin=0;xmax=1;Nx=10;
> xvec=linspace(xmin,xmax,Nx);
> yvec=xvec;zvec=5*xvec; %change here
> [x,y,z] = ndgrid(xvec,yvec,zvec);
> plot3(x(:),y(:),z(:),'.');axis equal;
>
> x(2,3,5)

It looks nice but not like cylinder

Subject: 3d Rectangualr Grid

From: Per Sundqvist

Date: 26 Jan, 2010 15:09:02

Message: 6 of 12

"Priya " <priya.biomath@gmail.com> wrote in message <hjmvmc$kbd$1@fred.mathworks.com>...
> "Per Sundqvist" <per.sundqvist@live.com> wrote in message <hjmq0h$6tg$1@fred.mathworks.com>...
> > "Priya " <priya.biomath@gmail.com> wrote in message <hjml2v$h9n$1@fred.mathworks.com>...
> > > "Per Sundqvist" <per.sundqvist@live.com> wrote in message <hjmk4v$hdp$1@fred.mathworks.com>...
> > > > "Piya " <priya.biomath@gmail.com> wrote in message <hjmdmn$rab$1@fred.mathworks.com>...
> > > > > Anyone have idea how to do this in Matlab?
> > > >
> > > > try:
> > > > help ndgrid
> > > >
> > > > /Per
> > >
> > > Thanks for command but for a learner it is not enough. I need a close cylinder with 3d rectangular grid for flow analysis using finite volume method.
> >
> > What about:
> >
> > xmin=0;xmax=1;Nx=10;
> > xvec=linspace(xmin,xmax,Nx);
> > yvec=xvec;zvec=5*xvec; %change here
> > [x,y,z] = ndgrid(xvec,yvec,zvec);
> > plot3(x(:),y(:),z(:),'.');axis equal;
> >
> > x(2,3,5)
>
> It looks nice but not like cylinder

You said rectangular grid. A cylinder is a body with fixed cross-section elongated along ,lets say the z-direction. Do you want this cross section to be both a circle and rectangular? You have to approximate the circle into rectangles that fits within the radii then?

Subject: 3d Rectangualr Grid

From: Priya

Date: 26 Jan, 2010 15:14:03

Message: 7 of 12

"Per Sundqvist" <per.sundqvist@live.com> wrote in message <hjn0ie$j0t$1@fred.mathworks.com>...
> "Priya " <priya.biomath@gmail.com> wrote in message <hjmvmc$kbd$1@fred.mathworks.com>...
> > "Per Sundqvist" <per.sundqvist@live.com> wrote in message <hjmq0h$6tg$1@fred.mathworks.com>...
> > > "Priya " <priya.biomath@gmail.com> wrote in message <hjml2v$h9n$1@fred.mathworks.com>...
> > > > "Per Sundqvist" <per.sundqvist@live.com> wrote in message <hjmk4v$hdp$1@fred.mathworks.com>...
> > > > > "Piya " <priya.biomath@gmail.com> wrote in message <hjmdmn$rab$1@fred.mathworks.com>...
> > > > > > Anyone have idea how to do this in Matlab?
> > > > >
> > > > > try:
> > > > > help ndgrid
> > > > >
> > > > > /Per
> > > >
> > > > Thanks for command but for a learner it is not enough. I need a close cylinder with 3d rectangular grid for flow analysis using finite volume method.
> > >
> > > What about:
> > >
> > > xmin=0;xmax=1;Nx=10;
> > > xvec=linspace(xmin,xmax,Nx);
> > > yvec=xvec;zvec=5*xvec; %change here
> > > [x,y,z] = ndgrid(xvec,yvec,zvec);
> > > plot3(x(:),y(:),z(:),'.');axis equal;
> > >
> > > x(2,3,5)
> >
> > It looks nice but not like cylinder
>
> You said rectangular grid. A cylinder is a body with fixed cross-section elongated along ,lets say the z-direction. Do you want this cross section to be both a circle and rectangular? You have to approximate the circle into rectangles that fits within the radii then?

what do you mean by "You have to approximate the circle into rectangles that fits within the radii then? "
can you write me little more about such things.

Subject: 3d Rectangualr Grid

From: Per Sundqvist

Date: 26 Jan, 2010 15:54:03

Message: 8 of 12

"Priya " <priya.biomath@gmail.com> wrote in message <hjn0rr$8kh$1@fred.mathworks.com>...
> "Per Sundqvist" <per.sundqvist@live.com> wrote in message <hjn0ie$j0t$1@fred.mathworks.com>...
> > "Priya " <priya.biomath@gmail.com> wrote in message <hjmvmc$kbd$1@fred.mathworks.com>...
> > > "Per Sundqvist" <per.sundqvist@live.com> wrote in message <hjmq0h$6tg$1@fred.mathworks.com>...
> > > > "Priya " <priya.biomath@gmail.com> wrote in message <hjml2v$h9n$1@fred.mathworks.com>...
> > > > > "Per Sundqvist" <per.sundqvist@live.com> wrote in message <hjmk4v$hdp$1@fred.mathworks.com>...
> > > > > > "Piya " <priya.biomath@gmail.com> wrote in message <hjmdmn$rab$1@fred.mathworks.com>...
> > > > > > > Anyone have idea how to do this in Matlab?
> > > > > >
> > > > > > try:
> > > > > > help ndgrid
> > > > > >
> > > > > > /Per
> > > > >
> > > > > Thanks for command but for a learner it is not enough. I need a close cylinder with 3d rectangular grid for flow analysis using finite volume method.
> > > >
> > > > What about:
> > > >
> > > > xmin=0;xmax=1;Nx=10;
> > > > xvec=linspace(xmin,xmax,Nx);
> > > > yvec=xvec;zvec=5*xvec; %change here
> > > > [x,y,z] = ndgrid(xvec,yvec,zvec);
> > > > plot3(x(:),y(:),z(:),'.');axis equal;
> > > >
> > > > x(2,3,5)
> > >
> > > It looks nice but not like cylinder
> >
> > You said rectangular grid. A cylinder is a body with fixed cross-section elongated along ,lets say the z-direction. Do you want this cross section to be both a circle and rectangular? You have to approximate the circle into rectangles that fits within the radii then?
>
> what do you mean by "You have to approximate the circle into rectangles that fits within the radii then? "
> can you write me little more about such things.

n=20;
x=linspace(-1,1,n);
[X,Y]=meshgrid(x,x);
r0=1.01;
ix=find(X.^2+Y.^2<r0^2);
X=X(ix);Y=Y(ix);
plot(X(:),Y(:),'.');axis equal;

I'm not sure it help you. You need to know nearest neighbour index as well, right?

Subject: 3d Rectangualr Grid

From: mat001

Date: 24 Mar, 2010 14:08:02

Message: 9 of 12

"Piya " <priya.biomath@gmail.com> wrote in message <hjmdmn$rab$1@fred.mathworks.com>...
> Anyone have idea how to do this in Matlab?


I need implementation like that on a bottom close cylinder

http://portal.acm.org/citation.cfm?id=1461512

Regards

Subject: 3d Rectangualr Grid

From: mat001

Date: 24 Mar, 2010 14:19:05

Message: 10 of 12

 n=20;
x=linspace(-1,1,n);
[X,Y,Z]=meshgrid(x,x,x);
r0=1.01;
ix=find(X.^2+Y.^2+Z.^2<r0^2);
X=X(ix);Y=2*Y(ix);Z=Z(ix);
plot3(X(:),Y(:),Z(:),'.');axis equal;
>> n=20;
x=linspace(-1,1,n);
[X,Y,Z]=meshgrid(x,x,x);
r0=1.01;
ix=find(X.^2+Y.^2+Z.^2<r0^2);
X=X(ix);Y=Y(ix);Z=2*Z(ix);
plot3(X(:),Y(:),Z(:),'.');axis equal;

not working !!

Subject: 3d Rectangualr Grid

From: mat001

Date: 24 Mar, 2010 14:27:05

Message: 11 of 12



n=40;
x=linspace(-1,1,n);
[X,Y,Z]=meshgrid(x,x,x);
r0=1.0;
ix=find(X.^2+Y.^2<r0^2);
X=X(ix);Y=Y(ix);Z=2*Z(ix);
plot3(X(:),Y(:),Z(:),'.');axis equal;


I do not know this is really what i want.

Subject: 3d Rectangualr Grid

From: mat001

Date: 28 May, 2010 13:48:21

Message: 12 of 12

"mat001 " <dres01@lycos.com> wrote in message <hod7fp$c0v$1@fred.mathworks.com>...
>
>
> n=40;
> x=linspace(-1,1,n);
> [X,Y,Z]=meshgrid(x,x,x);
> r0=1.0;
> ix=find(X.^2+Y.^2<r0^2);
> X=X(ix);Y=Y(ix);Z=2*Z(ix);
> plot3(X(:),Y(:),Z(:),'.');axis equal;
>
>
> I do not know this is really what i want.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us