!----------------------------------------------------------- !version: 25 September 2003 ! ! READ ME FIRST ! This beta-test code is provided by R. Grotjahn. It is a ! shell fortran file to illustrate use of ncar graphics ! to plot a point symbol and a line. ! It also illustrates some print and write commands. ! The intention is to provide the outlines of a simple ! program in which you can insert your own calculation ! It is recommended that you make a copy and modify the copy. ! !---------------------------------------- ! ! READ ME SECOND ! This is a script & fortran file to run a basic template of a ! program to draw lines and plot a 1-d array of points. ! Solid lines are illustrated ! ! This program also illustrates a simple written output procedure ! as well line plotting. See READ ME THIRD ! ! Other notes: ! to run your program, you make 2 unix commands. The first ! compiles & links the files; the second runs the job. ! Assume your file is called ptline.f then: ! ncargf90 ptline.f ! ./a.out ! ! To see your printed output look for the output file. ! To see your plotted output type: ! idt gmeta ! ! (default names are used above) !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ! ! READ ME THIRD ! ! your source code to generate the arrays goes between the ! first pair of lines that contain c repeated many times. To ! change the calls to the plot generation, make mods between ! the next pair of lines containing c repeated many times. ! ! For the purpose of this example, arrays F and X are created. PROGRAM PtLinePlot ! highly recommended to declare implicit none, to avoid using ! undefined variables. implicit none ! PARAMETER (Nx=81) ! Nx = # PTS IN F and X, ! real F(Nx),X(NX) real dx,pi,fmin,fmax,xmin,xmax,xw,xe,xmid,fabv integer nx,i,nxp CHARACTER*8 CHRS character*1 chrpt ! all statements above are non-executable PI=acos(-1.) ! define pi FMIN=1.E36 FMAX=-1.E36 dx=0.05 ! loop over the x points to calculate the corresponding f values DO I=1,NX X(I)=FLOAT(I-1)*dx-2. F(I)=COS(PI*X(I)) IF(F(I)>FMAX) FMAX=F(I) IF(F(I)