Path: news.mathworks.com!newsfeed-00.mathworks.com!oleane.net!oleane!ciril.fr!news.ecp.fr!news.motzarella.org!motzarella.org!news.greatnowhere.com!news.advenet.com!not-for-mail
Message-ID: <83146967ee46d@uwe>
From: "Bookie via MathKB.com" <u43093@uwe>
Subject: Re: Non-rectangular 3D plot
Date: Tue, 22 Apr 2008 22:58:27 GMT
Complaints-To: http://www.MathKB.com/Uwe/NB/ReportAbuse.aspx
Newsgroups: comp.soft-sys.matlab
References: <831044a106ed5@uwe> <fulhkn$ohs$1@aioe.org>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Lines: 55
Xref: news.mathworks.com comp.soft-sys.matlab:464649


alessandro mura wrote:
>>  I was wondering how I can make a 3D plot using non-rectandular data for x
>> and y.  My x-y domain can be described with limits: a <= x <= b AND 0 <= y 
>[quoted text clipped - 4 lines]
>>
>> Bookie
>
>If triangles are OK, istead of  4-sided polygons, then:
>
>x=randn(1,100)
>y=randn(1,100);
>z=x.^2-y.^2;
>tri=delaunay(x,y);
>hold on
>for i=1:size(tri,1)
>patch([x(tri(i,1)) x(tri(i,2)) x(tri(i,3))], [y(tri(i,1)) y(tri(i,2)) 
>y(tri(i,3))],[z(tri(i,1)) z(tri(i,2)) z(tri(i,3))],'g')
>end
>

Thanks Alessandro,

   So from what I get this code selects 100 random x-y points and calculatees
z for each point.  I have read into Delaunay triangulation, and I am not sure
how to use it. I do not know what the code does in the 'patch' function. As
well I don't see where I would enter my specific limits for x and y. 

Right now my points in the x-y domain lie within a 4-sided polygon, which I
could break into a 1 rectangle and 1 triangle.  If I am using delaunay
triangulation do I need to split my 4-sided polygon into 2 or more triangles
only? Does some part of your code represent the verticies of the triangle?  

Also my x and y coordinates are described by limits:  a <= x <= b AND 0 <= y
<= m*x+b.  I can make my x be a vector: x = a:1:b, but I do not know how to
make y be a vector. I would want: y = 0:1:(m*x+b), which doesn't work of
course. Or I could just say: y = min:1:max, but then I'm not incorporating
the relation between the y values and x values. 

Lastly, my z function is calling an m-file function: z = functionname(x,y).
So I can't use the dot operator to calculate the z-matrix values.  I then
want to plot z.  I could use surf, mesh, triplot, etc. I'm not sure which.  I
do not want z-values for my x-y coordinates outside of my polygon region, so
maybe I want holes in my surface plot.  I am wondering if I can return 'NaN',
for (x,y) coordinates outside of my region.

I appreciate your help and the help of this forum.  Whatever suggestions you
and anyone else has would be awesome!

Regards,
Bookie

-- 
Message posted via MathKB.com
http://www.mathkb.com/Uwe/Forums.aspx/matlab/200804/1