Generating Simple Meshes
Many Yorick calculations begin by defining an array of x values
which will be used as the argument to functions of a single variable. The
easiest way to do this is with the span or spanl function:
x = span(x_min, x_max, 200);
This gives 200 points equally spaced from x_min to x_max.
A two dimensional rectangular grid is most easily obtained as follows:
x = span(x_min, x_max, 50)(, -:1:40);
y = span(y_min, y_max, 40)(-:1:50, );
This gives a 50-by-40 rectangular grid with x varying fastest.
Such a grid is appropriate for exploring the behavior of a function of
two variables. Higher dimensional meshes can be built in this way, too.
|