home *** CD-ROM | disk | FTP | other *** search
- /* Demonstration of contour plotting */
-
- #define NPTS 41
-
- float tr[6] = {0.05, 0.0, -1.05, 0.0, 0.05, -1.05};
-
- static float clevel[11] = {-1.,-.8,-.6,-.4,-.2,0,.2,.4,.6,.8,1.};
-
- static int mark=1500, space=1500;
-
- main()
- {
- int i, j;
- float xx, yy;
- float z[NPTS][NPTS], w[NPTS][NPTS];
- void xform();
-
- for (i=0; i<NPTS; i++) {
- xx = (double)(i-(NPTS/2))/(double)(NPTS/2);
- for (j=0; j<NPTS; j++) {
- yy = (double)(j-(NPTS/2))/(double)(NPTS/2) - 1.0;
- z[i][j] = xx*xx - yy*yy;
- w[i][j] = 2*xx*yy;
- }
- }
-
- plstar(1,1);
- plenv(-1.0,1.0,-1.0,1.0,0,0);
- plcont(z,NPTS,NPTS,1,NPTS,1,NPTS,clevel,11,xform);
- plstyl(1,&mark,&space);
- plcont(w,NPTS,NPTS,1,NPTS,1,NPTS,clevel,11,xform);
- pllab("X Coordinate", "Y Coordinate","Contour Plots of Saddle Points");
- pltext();
- plend();
- }
-