Prev: imagesc, pcolor, and NaN
Next: MATLAB 2007a Craash
From: CENGIZ on 10 Feb 2010 06:38 Hello Roger, Your answer was helpful to me too. I have a very similar problem. I was wondering how i can make a 3d plot using a triangular domain. suppose that i need to plot z values for all (x,y) values within the triangular region (a1,b1), (a2,b2), and (a3,b3). I tried to use the parametrization technique you gave here, but could not figure out how to apply to my situation. Any thoughts would be appreciated. Best... "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <fum3cu$r2t$1(a)fred.mathworks.com>... > "Bookie" <u43093(a)uwe> wrote in message <831044a106ed5(a)uwe>... > > Hi, > > > > 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 <= > > m*x + b. Then z, forming the surface of the plot, will be a function of x > > and y. So the shadow of the plot will not look like a rectangle but some > > other 4-sided polygon. Thanks for you help in advance! > > > > Bookie > ---------- > In the 'surf' and 'surfc' functions it isn't necessary that the x-y domain > covered be a rectangle. It is only necessary that there be a two-parameter > representation of the desired surface in which the parameters fill a > rectangular space. In your example, you could use parameters, ix and iy > where > > [ix,iy] = meshgrid(1:p,1:q); % Use a p by q mesh of ix & iy values > x = a + (ix-1)*(b-a)/(p-1); % a <= x <= b > y = (iy-1).*(m*x+b)/(q-1); % 0 <= y <= m*x+b > z = (Whatever your function of x and y is) > surf(x,y,z) > > There is an example of a sphere generated by 'surf' in the function reference > to matlab. Study it to see how the parameterization works. In particular note > that what you call the "shadow" is a circle in this case. > > Roger Stafford >
From: Luigi Giaccari on 11 Feb 2010 11:28 "Bookie" <u43093(a)uwe> wrote in message <831044a106ed5(a)uwe>... > Hi, > > 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 <= > m*x + b. Then z, forming the surface of the plot, will be a function of x > and y. So the shadow of the plot will not look like a rectangle but some > other 4-sided polygon. Thanks for you help in advance! > > Bookie > I hope one of these works http://www.mathworks.com/matlabcentral/newsreader/create_message?reply_id=711429 http://www.advancedmcode.org/how-to-plot-a-coloured-surface-from-3d-scatter.html http://www.advancedmcode.org/surface-recostruction-from-scattered-points-cloud-mycrustopen.html http://www.advancedmcode.org/surface-recostruction-from-scattered-points-cloud-mycrust-robust.html http://www.advancedmcode.org
From: Roger Stafford on 26 Feb 2010 23:07 "CENGIZ " <cengizucbenli(a)gmail.com> wrote in message <hku5qs$81c$1(a)fred.mathworks.com>... > Hello Roger, > > Your answer was helpful to me too. I have a very similar problem. I was wondering how i can make a 3d plot using a triangular domain. suppose that i need to plot z values for all (x,y) values within the triangular region (a1,b1), (a2,b2), and (a3,b3). I tried to use the parametrization technique you gave here, but could not figure out how to apply to my situation. Any thoughts would be appreciated. > > Best... Hello Cengiz. Sorry for the delay. I didn't notice your question when it appeared Feb. 10. With a triangle whose vertices are (a1,b1), (a2,b2), and (a3,b3) in the x-y plane, you can generate points falling within the triangle parametrically using two parameters p and q defined by: x = p*a1 + (1-p)*(q*a2 + (1-q)*a3) y = p*b1 + (1-p)*(q*b2 + (1-q)*b3) with p and q in the rectangular (actually square) region 0 <= p <= 1 0 <= q <= 1 (This does have the disadvantage that points will be clustered more densely near the (a1,b1) vertex.) Roger Stafford
|
Pages: 1 Prev: imagesc, pcolor, and NaN Next: MATLAB 2007a Craash |