home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 344b.lha / plplot_v2.6 / examples / example09.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-27  |  888 b   |  36 lines

  1. /* Demonstration of contour plotting */
  2.  
  3. #include "plplot.h"
  4.  
  5. #define NPTS      41
  6.  
  7. float tr[6] = {0.05, 0.0, -1.0, 0.0, 0.05, -1.0};
  8.  
  9. main()
  10. {
  11.    int i, j;
  12.    float xx, yy;
  13.    static float clevel[11] = {-1.,-.8,-.6,-.4,-.2,0,.2,.4,.6,.8,1.};
  14.    static float z[NPTS][NPTS], w[NPTS][NPTS];
  15.    static int mark=1500, space=1500;
  16.  
  17.    for (i=0; i<NPTS; i++) {
  18.      xx = (double)(i-(NPTS/2))/(double)(NPTS/2);
  19.      for (j=0; j<NPTS; j++)  {
  20.        yy = (double)(j-(NPTS/2))/(double)(NPTS/2) - 1.0;
  21.        z[i][j] = xx*xx - yy*yy;
  22.        w[i][j] = 2*xx*yy;
  23.      }
  24.    }
  25.    plstar(1,1);
  26.    plenv(-1.0,1.0,-1.0,1.0,0,0);
  27.    plcol(2);
  28.    plcont(&z[0][0],NPTS,NPTS,1,NPTS,1,NPTS,clevel,11,xform);
  29.    plstyl(1,&mark,&space);
  30.    plcol(3);
  31.    plcont(&w[0][0],NPTS,NPTS,1,NPTS,1,NPTS,clevel,11,xform);
  32.    plcol(1);
  33.    pllab("X Coordinate", "Y Coordinate","Contour Plots of Saddle Points");
  34.    plend();
  35. }
  36.