Thread Subject: How to plot a graph with discrete points?

Subject: How to plot a graph with discrete points?

From: zedong

Date: 21 Sep, 2009 09:22:01

Message: 1 of 7

I have a problem on plot the graph.
I only have the following data
figgg=[x_i,y_i,z_i].
for example:
x=rand(100,1);
y=rand(100,1);
z=x.^2+y.^2;
figgg=[x,y,z];
you can use this figgg for test.
But as a matter of fact now I only have the figgg,I don't know how it's computed out. I want to plot a graph to see the 2d function.Thank you very much

Subject: How to plot a graph with discrete points?

From: Didi Cvet

Date: 21 Sep, 2009 12:06:03

Message: 2 of 7

"zedong
" <zdongwu@gmail.com> wrote in message <h97gjp$k4m$1@fred.mathworks.com>...
> I have a problem on plot the graph.
> I only have the following data
> figgg=[x_i,y_i,z_i].
> for example:
> x=rand(100,1);
> y=rand(100,1);
> z=x.^2+y.^2;
> figgg=[x,y,z];
> you can use this figgg for test.
> But as a matter of fact now I only have the figgg,I don't know how it's computed out. I want to plot a graph to see the 2d function.Thank you very much

I think that this is 3D function (because you have 3 arguments)
Plot them with
>>plot3(x,y,z)

Subject: How to plot a graph with discrete points?

From: zedong

Date: 21 Sep, 2009 14:08:03

Message: 3 of 7

"Didi Cvet" <didi_cvet@yahoo.com> wrote in message <h97q7b$min$1@fred.mathworks.com>...
> "zedong
> " <zdongwu@gmail.com> wrote in message <h97gjp$k4m$1@fred.mathworks.com>...
> > I have a problem on plot the graph.
> > I only have the following data
> > figgg=[x_i,y_i,z_i].
> > for example:
> > x=rand(100,1);
> > y=rand(100,1);
> > z=x.^2+y.^2;
> > figgg=[x,y,z];
> > you can use this figgg for test.
> > But as a matter of fact now I only have the figgg,I don't know how it's computed out. I want to plot a graph to see the 2d function.Thank you very much
>
> I think that this is 3D function (because you have 3 arguments)
> Plot them with
> >>plot3(x,y,z)
plot3 can only plot point.I want to plot cloudy figure.like the function trisurf.But trisurf need mesh information.I don't have mesh information

Subject: How to plot a graph with discrete points?

From: Didi Cvet

Date: 22 Sep, 2009 10:24:19

Message: 4 of 7

"zedong
" <zdongwu@gmail.com> wrote in message <h981c3$9pl$1@fred.mathworks.com>...
> "Didi Cvet" <didi_cvet@yahoo.com> wrote in message <h97q7b$min$1@fred.mathworks.com>...
> > "zedong
> > " <zdongwu@gmail.com> wrote in message <h97gjp$k4m$1@fred.mathworks.com>...
> > > I have a problem on plot the graph.
> > > I only have the following data
> > > figgg=[x_i,y_i,z_i].
> > > for example:
> > > x=rand(100,1);
> > > y=rand(100,1);
> > > z=x.^2+y.^2;
> > > figgg=[x,y,z];
> > > you can use this figgg for test.
> > > But as a matter of fact now I only have the figgg,I don't know how it's computed out. I want to plot a graph to see the 2d function.Thank you very much
> >
> > I think that this is 3D function (because you have 3 arguments)
> > Plot them with
> > >>plot3(x,y,z)
> plot3 can only plot point.I want to plot cloudy figure.like the function trisurf.But trisurf need mesh information.I don't have mesh information


I'm not sure but try this:

[xx yy]=meshgrid(rand(100,1));
>> zz=xx.^2+yy.^2;
>> surfc(xx,yy,zz)
>> surf(xx,yy,zz)
>> mesh(xx,yy,zz)
one of those plot functions might help you.

Subject: How to plot a graph with discrete points?

From: zedong

Date: 22 Sep, 2009 11:07:04

Message: 5 of 7

"Didi Cvet" <didi_cvet@yahoo.com> wrote in message <h9a8kj$ru6$1@fred.mathworks.com>...
> "zedong
> " <zdongwu@gmail.com> wrote in message <h981c3$9pl$1@fred.mathworks.com>...
> > "Didi Cvet" <didi_cvet@yahoo.com> wrote in message <h97q7b$min$1@fred.mathworks.com>...
> > > "zedong
> > > " <zdongwu@gmail.com> wrote in message <h97gjp$k4m$1@fred.mathworks.com>...
> > > > I have a problem on plot the graph.
> > > > I only have the following data
> > > > figgg=[x_i,y_i,z_i].
> > > > for example:
> > > > x=rand(100,1);
> > > > y=rand(100,1);
> > > > z=x.^2+y.^2;
> > > > figgg=[x,y,z];
> > > > you can use this figgg for test.
> > > > But as a matter of fact now I only have the figgg,I don't know how it's computed out. I want to plot a graph to see the 2d function.Thank you very much
> > >
> > > I think that this is 3D function (because you have 3 arguments)
> > > Plot them with
> > > >>plot3(x,y,z)
> > plot3 can only plot point.I want to plot cloudy figure.like the function trisurf.But trisurf need mesh information.I don't have mesh information
>
>
> I'm not sure but try this:
>
> [xx yy]=meshgrid(rand(100,1));
> >> zz=xx.^2+yy.^2;
> >> surfc(xx,yy,zz)
> >> surf(xx,yy,zz)
> >> mesh(xx,yy,zz)
> one of those plot functions might help you.
Yes ,You are right.But I now only have the data [x_i,y_i,z_i],I don't have the structure.surf need z be a matrix but my z is a vector.Thank you

Subject: How to plot a graph with discrete points?

From: arich82

Date: 23 Sep, 2009 09:19:03

Message: 6 of 7

> > > > > I only have the following data
> > > > > figgg=[x_i,y_i,z_i].
> > > > > for example:
> > > > > x=rand(100,1);
> > > > > y=rand(100,1);
> > > > > z=x.^2+y.^2;
> > > > > figgg=[x,y,z];
> > > > > you can use this figgg for test.

> Yes ,You are right.But I now only have the data [x_i,y_i,z_i],I don't have the structure.surf need z be a matrix but my z is a vector.Thank you



Is this what you're looking for?

tri = delaunay(x,y);
h = trisurf(tri, x, y, z);

See <http://www.mathworks.com/matlabcentral/fx_files/5105/1/content/surf_from_scatter.html>, and maybe <http://www.mathworks.com/matlabcentral/fileexchange/8998>.

Subject: How to plot a graph with discrete points?

From: zedong

Date: 13 Oct, 2009 14:36:04

Message: 7 of 7

"arich82 " <|a|r|i|c|8|2|@hotmail.com> wrote in message <h9cp67$t60$1@fred.mathworks.com>...
> > > > > > I only have the following data
> > > > > > figgg=[x_i,y_i,z_i].
> > > > > > for example:
> > > > > > x=rand(100,1);
> > > > > > y=rand(100,1);
> > > > > > z=x.^2+y.^2;
> > > > > > figgg=[x,y,z];
> > > > > > you can use this figgg for test.
>
> > Yes ,You are right.But I now only have the data [x_i,y_i,z_i],I don't have the structure.surf need z be a matrix but my z is a vector.Thank you
>
>
>
> Is this what you're looking for?
>
> tri = delaunay(x,y);
> h = trisurf(tri, x, y, z);
>
> See <http://www.mathworks.com/matlabcentral/fx_files/5105/1/content/surf_from_scatter.html>, and maybe <http://www.mathworks.com/matlabcentral/fileexchange/8998>.

Thank you very much.That must be the best solution.I have never thought about it.Very beautiful

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
plot3 Didi Cvet 21 Sep, 2009 08:09:05
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com