"misty m." <donotspam@smth.be> wrote in message <g0708i$q5a
$1@fred.mathworks.com>...
> maybe i should describe my problem better. i've got 113
> figures, similar to circles. i've got control points(x,y)
> of each of them. for one circle i can have for example 100
> control points, for another one i can have 120. so i put
> them into cells:
> X={x(ii)}
> Y={y{ii}}
>
> now i must plot them as a solid. i decided that the
> distance between will be =1. so i have the third coefficient
> Z={z(ii)}.
>
> i cannot use any functions (sin/cos etc) to help me
> generate my circles and later solid. i can only use my
> control points (X,Y,Z).
> when i try to use meshgrid to use mesh later, then i got an
> error that vectors are too big.
> i need somtething as easy as plot3, but giving nicer
> results

As Alessandro has illustrated, to be able to use 'surf', it is necessary to have
your surface defined in terms of three equalsized x, y, and z coordinate
twodimensional (rectangular) arrays. The two indices of the arrays are, in
effect, two parameters for points on the surface being displayed and these
parameters lie within a rectangular mesh defined by the size of the arrays.
This enables the 'surf' function to draw little line segments between any point
P0 = (x(i,j),y(i,j),z(i,j))
and each of its four neighbors
P1 = (x(i+1,j),y(i+1,j),z(i+1,j))
P2 = (x(i,j+1),y(i,j+1),z(i,j+1))
P3 = (x(i1,j),y(i1,j),z(i1,j))
P4 = (x(i,j1),y(i,j1),z(i,j1))
It is this association by way of line segments between points and their
neighbors that causes the plot to be "a nicer graph", as you have described it.
It is what distinguishes the output of 'surf' from that of 'plot3'.
In your problem, the z coordinate itself clearly defines one of your
parameters, but what you refer to as "control points" in your figures have
differing numbers of points in the various figures, leaving you no clear way to
draw line segments between neighboring points in different figures, as would
be the case in a rectangular parametric mesh. How is any plotting routine
going to create such line segments in any reasonable manner?
My advice would be something along the following lines. Establish some
common parameter along all the figures such that two points with the same
parameter on adjacent figures would be reasonable neighbors of one another.
Perhaps arc length along a figure divided by its total arc length would be
appropriate, or normalized cumulative chord lengths between successive
points as an approximation to this. Then interpolate between the given
points in each figure and a set of points with a common spacing for all the
figures with respect to this parameter. These new interpolated points would
have the same count on each figure and could then be used as the
appropriate mesh input to 'surf'.
Roger Stafford
