# Dibujar un sólido 2-D

Saltar a: navegación, buscar
Mesh in a rectangular solid

We show how to draw meshes of plane regions, representing solids, with Octave UPM. The objective is to be able of visualizing physical quantities in the mesh points. We start with the simplest example, the rectangle $[-1/2,1/2]\times [0,2]$. We follow the steps:

1. We introduce a sampling of the two segments with a suitable step
2. With meshgrid command we define two matrixes with the x and y coordinates of the mesh points
3. We use the mesh command to draw the mesh and adjunst the axis. We see the mesh from the top.

## 1 MATLAB code

1 x=-0.5:0.1:0.5;       % sampling of the interval [-1/2,1/2]
2 y=0:0.1:2;            % sampling of the interval [0,2]
3 [xx,yy]=meshgrid(x,y); % matrixes of x and y coordinates
4 figure(1)
5 mesh(xx,yy,0*xx)       % Draw the mesh
6 axis([-2,2,-1,3])      % select region for drawing
7 view(2)                % See the picture from the top