Data Files -> Contour Plots
Contour Plots -> PNG Images
PNG Images -> Animation

CONTOUR_SEQUENCE4 is a MATLAB program which reads one XY coordinate file, and a sequence of U(X,Y) datasets, creates contour plots, and saves them as PNG files which can be combined into an animation (by Quicktime Pro, for instance).

The solution files containing the U(X,Y) data should have 'consecutive' names, such as "fred01.txt", "fred02.txt", "fred03.txt" and so on. The user only has to tell the program to process the first file, and it will automatically continue to process files until it reaches the end of the sequence of names.

The input files:

The X and Y input data files store the values of X and Y for points on a regularly spaced grid. The grid does not have to be evenly spaced, but for this program to work, it must be the case that the (X,Y) points form an M by N grid, and that the value of X or of Y is constant along a grid line!

(In other words, a square grid is fine, but a rectangular grid is OK too. A rectangular grid with constant spacing is fine; a rectangular grid with variable spacing is also OK. But a slanted, "wiggly" or curved grid is no good.)

Each U input data file is assumed to store the value of the associated scalar U.

Also, the grid of points in the data file must be listed in a reasonable order, either by rows or by columns.

Internal processing:

The program has to figure out the grid parameters M and N, and convert the vectors of data X, Y, U into doubly indexed arrays that can be handled by the MATLAB contour routine. Once the contour plot is displayed, an image of it is saved as a PNG file.

Once the first file is processed, the routine checks to see if there is a second "consecutive" file, and it so, it is also processed, and so on, until presumably all files in the sequence have been handled.


contour_sequence4 xy_file u_file
where xy_file contains the node coordinates, and u_file is the first file in a numerically related sequence.


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


CONTOUR_SEQUENCE4 is available in a MATLAB version.

Related Data and Programs:

DIST_PLOT, a MATLAB program which makes contour plots of the distance function, as defined and used in Persson and Strang's distmesh code;

FEM2D_HEAT, a MATLAB program which solves the 2D time dependent heat equation. The output from this program includes an XY file and a series of U files containing the solution (temperature) at each node. This data is suitable for processing by CONTOUR_SEQUENCE4.

LEVELS, a MATLAB library which makes a contour plot, choosing the contour levels using random sampling.

TRIANGULATION_ORDER3_CONTOUR, a MATLAB program which makes contour plot of scattered data, or of data defined on an order 3 triangulation.

TRIANGULATION_ORDER6_CONTOUR, a MATLAB program which makes contour plots of data defined on an order 6 triangulation.

VECTOR_MAGNITUDE_GRID, a MATLAB program which reads vector data at "scattered" points, computes an interpolatory function, evaluates it on a uniform grid of user-specified density, and produces a contour plot of the vector magnitude.

Source Code:

Examples and Tests:

PNG image files you can copy include:

You can go up one level to the MATLAB source codes.

Last revised on 18 September 2005.