home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 035 / splot122.zip / DEMO / ERRORBAR.SPT < prev    next >
Text File  |  1994-07-07  |  1KB  |  44 lines

  1. #include <splot.h>
  2.  
  3. /* This example file illustrates the use of errorbars and straight */
  4. /* line fits to data. It also uses a small internal data array rather */
  5. /* than reading data in from a file */
  6.  
  7. double data[4][4] = {
  8.    1.2, 0.24, 0.1, 1,
  9.    2.0, 0.43, 0.1, 1, 
  10.    4.0, 0.52, 0.1, 1, 
  11.    6.0, 0.87, 0.1, 1}; 
  12.  
  13. double yint,slope;
  14.  
  15.  
  16. main()
  17.    {
  18.    set(LINEWIDTH,0.1);
  19.    set(PLOTTYPE,SYMBOLS);
  20.    axes_box(12,15,0,0,8,1.0);
  21.    tickmarks();
  22.    set(FONTWIDTH,0.5);
  23.    ticklabel();
  24.    set(FONTWIDTH,0.7);
  25.  
  26.    label(BOTTOM,"SiGe Well Width in (nm)");
  27.    label(LEFT,"Biexciton Lifetime in (!m!s)");
  28.  
  29.    text(10.03,22.56,"MBE SiGe Quantum Wells",CENTER);
  30.  
  31.    /* draw the data points  */
  32.    drawdata(data,0,1);
  33.  
  34.    /* put in the error bars for the x values */
  35.    errorbars(XVALS,data,0,1,3);
  36.    /* put in the error bars for the y values */
  37.    errorbars(YVALS,data,0,1,2);
  38.  
  39.    /* fit the best line to the data and return the slope and intercept */
  40.    fitline(data,0,1,&yint,&slope);
  41.    print(slope);
  42.    print(yint);
  43.    }
  44.