Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: 3D plot over a triangle region
Date: Fri, 20 Jan 2012 18:00:10 +0000 (UTC)
Organization: Aalborg Universitet
Lines: 10
Message-ID: <jfca3a$r4q$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1327082410 27802 172.30.248.45 (20 Jan 2012 18:00:10 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 20 Jan 2012 18:00:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2460473
Xref: news.mathworks.com comp.soft-sys.matlab:755241

Hello, 

I have the following 3D funktion that I want to plot over a triangular region instead of a rectangular region. How can I solve this problem, and is it possible to z(max)=1

[x,y] = meshgrid(0:0.1:1);
z = x*(2*x.^2+2*y^2+2*(1-x-y).^2+3*y.*(1-x-y)-1);
figure
surf(x,y,z)

Best regards Anna