How to define a meshgrid (x,y) between the intersection of two oblique lines.

552 Views Asked by At

The two oblique lines

How can I create a meshgrid to draw a 3d surface in a domain (zone 1) defined by the intersection of two oblique lines in Matlab (see attached figure)1. The variables 0

1

There are 1 best solutions below

4
On

the matlab meshgrid outputs two rectangular grids.

If you just want to display the surface in zone $1$ and not the others,

[x,y] = meshgrid(0:0.01:3); z = your_function(x,y).*((y > 0.5*x + 1) & (y > 6*x - 2)); surf(z)

should do it (I'm just using a logical condition to mask off the area of interest, and set the function equal to zero elsewhere).