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:
3 dimensional matlab implicit plot

Subject: 3 dimensional matlab implicit plot

From: sun

Date: 20 Jul, 2007 12:04:16

Message: 1 of 6

Hi, can somebody help me please to create a plot of
x^2+y^2=(sin(z))^2? Thank you Sun

Subject: 3 dimensional matlab implicit plot

From: Vincent Morio

Date: 10 Feb, 2008 01:01:02

Message: 2 of 6

 sun <bianaib@gmail.com> wrote in message
<1184958256.447646.79500@n2g2000hse.googlegroups.com>...
> Hi, can somebody help me please to create a plot of
> x^2+y^2=(sin(z))^2? Thank you Sun
>

Hi,

You can use for instance the Matlab "ndgrid" and
"isosurface" functions to generate your 3D implicit plot.
The rendering is similar to the one obtained with the
"plotimplicit3d" Maple function.

[Y,X,Z] =
ndgrid(linspace(-2,2,15),linspace(-2,2,15),linspace(-2,2,15));
V = Y.^2+Y.^2-(sin(Z)).^2; % evaluate your implicit function
over the N-D grid
p = patch(isosurface(X,Y,Z,V,0));
isonormals(X,Y,Z,V,p);
set(p,'FaceColor','b','EdgeColor','k','FaceAlpha',0.5); % ou
'EdgeColor','none'
daspect([1 1 1])
axis square;
grid on;
camlight
view(-27,46);
lighting gouraud

Regards,
V. Morio

Subject: 3 dimensional matlab implicit plot

From: Patrick Toche

Date: 6 Mar, 2008 18:21:02

Message: 3 of 6

Thank you Vincent, your trick works wonders.

I'd been wondering how to do in matlab what maple does with
the "implicitplot3d" command. Now I know.

Subject: 3 dimensional matlab implicit plot

From: Patrick Toche

Date: 6 Mar, 2008 18:21:02

Message: 4 of 6

Thank you Vincent, your trick works wonders.

I'd been wondering how to do in matlab what maple does with
the "implicitplot3d" command. Now I know.

Subject: 3 dimensional matlab implicit plot

From: Jonathan

Date: 7 Oct, 2010 16:01:05

Message: 5 of 6

Vincent,

This method of plotting is just what I needed. I had not used isosurface before. Now that I have seen your approach and looked up the functions you used, it seems like a very direct way to accomplish the goal.

Are you aware of a method of doing the same that is less computationally complex? This method requires numel(V) function evaluations when a small percentage of this many points are plotted.

Thanks,
Jonathan

"Vincent Morio" <vincent.morio@mathworks.com> wrote in message <folicd$emk$1@fred.mathworks.com>...
> sun <bianaib@gmail.com> wrote in message
> <1184958256.447646.79500@n2g2000hse.googlegroups.com>...
> > Hi, can somebody help me please to create a plot of
> > x^2+y^2=(sin(z))^2? Thank you Sun
> >
>
> Hi,
>
> You can use for instance the Matlab "ndgrid" and
> "isosurface" functions to generate your 3D implicit plot.
> The rendering is similar to the one obtained with the
> "plotimplicit3d" Maple function.
>
> [Y,X,Z] =
> ndgrid(linspace(-2,2,15),linspace(-2,2,15),linspace(-2,2,15));
> V = Y.^2+Y.^2-(sin(Z)).^2; % evaluate your implicit function
> over the N-D grid
> p = patch(isosurface(X,Y,Z,V,0));
> isonormals(X,Y,Z,V,p);
> set(p,'FaceColor','b','EdgeColor','k','FaceAlpha',0.5); % ou
> 'EdgeColor','none'
> daspect([1 1 1])
> axis square;
> grid on;
> camlight
> view(-27,46);
> lighting gouraud
>
> Regards,
> V. Morio
>

Subject: 3 dimensional matlab implicit plot

From: Roger Stafford

Date: 7 Oct, 2010 16:31:04

Message: 6 of 6

 sun <bianaib@gmail.com> wrote in message <1184958256.447646.79500@n2g2000hse.googlegroups.com>...
> Hi, can somebody help me please to create a plot of
> x^2+y^2=(sin(z))^2? Thank you Sun
- - - - - - - -
  You can also use 'surf' with a parametric representation of your surface.

 z = linspace(0:4*pi); % <-- Or whatever range you want for z
 t = linspace(0:2*pi);
 [Z,T] = meshgrid(z,t);
 X = sin(Z).*cos(T);
 Y = sin(Z).*sin(T);
 surf(X,Y,Z)

Roger Stafford

Tags for this Thread

No tags are associated with 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