LAB 6: THREE-DIMENSIONAL GRAPHICS AND CURVILINEAR GRIDS

** **

__Mathematics: __

A function of two
variables ** u = f(x,y) **is plotted as a surface in a space of three
dimensions

MATLAB
three-dimensional graphics can be used for functions defined at the curvilinear
grids. If ** (x_{i,j},y_{i,j})
**are matrices for the
coordinates of the curvilinear grid points, the function

__Objectives:__

·
Understand
methods of building grid matrices ** (x_{i,j},y_{i,j})
** from coordinates of the curvilinear grid points.

·
Exploit
visualization of surfaces with circular symmetry.

·
Exploit
visualization of surfaces defined at the triangular grids.

* *

When the function ** u = f(x,y) **has a circular symmetry and is defined in a
disk or in an annulus, it is convenient to locate the grid points at circles of
radius

*x = r*cos( _{}), y = r*sin(_{}),*

where ** r **is radius from

*u = _{}(R^{2} – (r-a)^{2})^{1/2} for a-R _{} r _{} a+R,*

where ** a > R. **The circular grid for the torus and the
surface in the space

* *

*Steps
in writing the script:*

- Define the grid for
radius vector
between*r*for*[a-R,a+R]*and*R = 1**a = 2.* - Define the grid for
angle vector theta between
*[0,2*pi].* - Compute the matrices
and*x*_{i,j }in polar coordinates. Use the outer products of vectors*y*_{i,j }and*r*_{}*.* - Open window #1 and plot
the circular grid alone.
- Compute the matrix
for each grid point on the circular grid.*u*_{i,j} - Open window #2 and plot
the contour plots of the torus between
and*u = 0**u = u*_{max}. - Open window #3 and plot
the surface for the torus. Display positive and negative values of
at the same graph. Draw the surface and the circular grid at the same graph.*u*

*Exploiting
the MATLAB script:*

- Use surface with
lighting for the following colormaps:
**hot, cold, jet, grey.**Observe the difference in visualization of the surface. - Use surface with
lighting for the following shadings:
**flat, interp.**Observe the difference in visualization of the surface. - Change view of the tour
by rotating the graph with
**view.**

When the function ** u = f(x,y) **is computed as solution of a boundary value
problem based on finite element methods, the function is usually defined on a
triangular grid, that consists of triangular elements. An example of a
triangular grid consisting of

Suppose the
function ** u = f(x,y) =
cos(x)*sin(y) **is computed in
the vertices of the triangular grid (e.g. with the use of the finite-element
method). When the numerical approximation of the function

*Steps
in writing the script:*

- Define a structure for
two coordinates of each vertex (nodal point) on the triangular grid.
- Define a structure for
three vertex point numbers of each triangular element of the triangular
grid
*.* - Open window #1 and plot
the triangular grid alone.
- Build the matrices
for coordinates of the triangular grid.*(x*_{i,j},y_{i,j}) - Compute the matrix
for each grid point at the triangular grid.*u*_{i,j} - Open window #2 and plot
6 contour plots of the function
Draw the boundary of the domain at the same graph.*u = f(x,y).* - Open window #3 and plot
the surface for the function
. Display positive and negative values of*u = f(x,y)*at the same graph. Draw the surface and the grid at the same graph.*u*

*Exploiting
the MATLAB script:*

- Construct the same
function
*u = f(x,y) = cos(x)*sin(y)*on a rectangular grid betweenand*–4*_{}x_{}4with step-size*-4*_{}y_{}4*1.* - Draw the contour plot and the surface as in steps (6)-(7). Compare
the approximation of the function on rectangular and triangular grids.

__ __

- Plot the sausaged torus
defined in polar coordinates:

*u = _{}(R^{2} – (r-a)^{2})^{1/2}*cos(3_{}) for a-R _{} r _{} a+R*

- Plot the lump soliton
in the disk of radius
by using polar coordinates:*4*

*u = (1 + y ^{2} – x^{2})/(1 + x^{2}
+ y^{2})^{2}*