COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Smooth surface mesh/grid

• Email
• Follow

```Using surface to create a patch grid results in a jagged surface.

[x,y]=meshgrid(-2:0.5:2,-2:0.5:2);
z = x.^2-cos(5*x).*y.^2;
surface(x,y,z,'EdgeColor',[.8 .8 .8],'FaceColor','none')

Because I'm computing contour's and full colored surfaces I have a much finer meshgrid than above.

[x,y]=meshgrid(-2:0.01:2,-2:0.01:2);
z = x.^2-cos(5*x).*y.^2 + 0.3;
surf(x,y,z, 'EdgeColor', 'none');
alpha(0.35);
colormap(bone(512));

I would like to use the finer grid as a way to interpolate the grid lines for the grid plot so make it smoother. (or essentiallly draw every 5 to 10 grid lines on a finer grid)

If I use the finer meshgrid then I get too dense grid lines which makes it useless.

I also use hidden surface removal so I assume that the grid has to be made up of patches which have linear edges. This probably means I can't do what I want to do ;.

Any ideas?
```
 0

See related articles to this posting

```"Jo " <bobbyjoe23928@gmail.com> wrote in message <hq0kk5\$g87\$1@fred.mathworks.com>...
> Using surface to create a patch grid results in a jagged surface.
>
> [x,y]=meshgrid(-2:0.5:2,-2:0.5:2);
> z = x.^2-cos(5*x).*y.^2;
> surface(x,y,z,'EdgeColor',[.8 .8 .8],'FaceColor','none')
>
>
> Because I'm computing contour's and full colored surfaces I have a much finer meshgrid than above.
>
> [x,y]=meshgrid(-2:0.01:2,-2:0.01:2);
> z = x.^2-cos(5*x).*y.^2 + 0.3;
> surf(x,y,z, 'EdgeColor', 'none');
> alpha(0.35);
> colormap(bone(512));
>
> I would like to use the finer grid as a way to interpolate the grid lines for the grid plot so make it smoother. (or essentiallly draw every 5 to 10 grid lines on a finer grid)
>
> If I use the finer meshgrid then I get too dense grid lines which makes it useless.
>
> I also use hidden surface removal so I assume that the grid has to be made up of patches which have linear edges. This probably means I can't do what I want to do ;.
>
> Any ideas?

not clear on what you want.. using a fine meshgrid and surf to plot results in a smooth surface...If grid lines are too dense, turn them off. Use contour to plot contour lines at an interval you specify.
John D'Errico's submission GridFit may be of use.
```
 0

```"Jo " <bobbyjoe23928@gmail.com> wrote in message <hq0kk5\$g87\$1@fred.mathworks.com>...
> Using surface to create a patch grid results in a jagged surface.
>
> [x,y]=meshgrid(-2:0.5:2,-2:0.5:2);
> z = x.^2-cos(5*x).*y.^2;
> surface(x,y,z,'EdgeColor',[.8 .8 .8],'FaceColor','none')
>
>
> Because I'm computing contour's and full colored surfaces I have a much finer meshgrid than above.
>
> [x,y]=meshgrid(-2:0.01:2,-2:0.01:2);
> z = x.^2-cos(5*x).*y.^2 + 0.3;
> surf(x,y,z, 'EdgeColor', 'none');
> alpha(0.35);
> colormap(bone(512));
>
> I would like to use the finer grid as a way to interpolate the grid lines for the grid plot so make it smoother. (or essentiallly draw every 5 to 10 grid lines on a finer grid)
>

Is this what you're looking for?

http://www.mathworks.com/matlabcentral/fileexchange/9315-wireframe

[x,y]=meshgrid(-2:0.01:2,-2:0.01:2);
z = x.^2-cos(5*x).*y.^2 + 0.3;
surf(x,y,z, 'EdgeColor', 'none');
alpha(0.35);
colormap(bone(512));
wireframe(x,y,z,50);

-Kelly
```
 0