MATLAB Answers

How to make this surface?

1 view (last 30 days)
mc18004
mc18004 on 4 Dec 2019
Answered: Akira Agata on 4 Dec 2019
z = y*x
0<x<5
x/2<y<2

  0 Comments

Sign in to comment.

Answers (1)

Akira Agata
Akira Agata on 4 Dec 2019
Straight-foward solution would be like this:
x = linspace(0,5);
y = linspace(0,2);
[xGrid, yGrid] = meshgrid(x,y);
zGrid = yGrid.*xGrid;
idx = xGrid./2 < yGrid;
zGrid(idx) = nan;
figure
surf(xGrid,yGrid,zGrid)

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags