Graphing with FORTRAN

Content:

  1. Linux - g2 Library

  2. MsDOS - FBENCH

Öğr.Gör.Ahmet Bingül
bingul@gantep.edu.tr


Introduction

One can use the graphics utilities to draw anything by Profor Fortran77 compiler. Click here to download the compiler.

A seperate library ( F77PC library ) contains all the essential graphics primitives necessary to drive the Hercules, CGA , EGA and VGA screens for graph plotting.

/\ Top

Drawing Screen

Top-Left of the graphic screen is (0,0) and rigth-bottom is (649,479) if secreenmode is selected to be 18.

/\ Top

Drawing Functions


sets the current drawing color
____________________
 Color        ¦Value
--------------+-----
 BLACK        ¦  0
 BLUE         ¦  1
 GREEN        ¦  2
 CYAN         ¦  3
 RED          ¦  4
 MAGENTA      ¦  5
 BROWN        ¦  6
 LIGHTGRAY    ¦  7
 DARKGRAY     ¦  8
 LIGHTBLUE    ¦  9
 LIGHTGREEN   ¦ 10
 LIGHTCYAN    ¦ 11
 LIGHTRED     ¦ 12
 LIGHTMAGENTA ¦ 13
 YELLOW       ¦ 14
 WHITE        ¦ 15
--------------------
Function Description Example
CALL PLOT(X,Y,C) plots a pixel at a specified point in the color C at point (X,Y) . plot example
CALL DRAW(X1,X2,Y1,Y2,C) draws a line from point (X1,Y1) to point (X2,Y2) in the color C draw example
CALL CIRCLE(X,Y,R,C) draws a circle, whose center point is (X,Y) and whose radius is R , in the color C circle example

/\ Top

Example Applications

Description Program Code Output
Draws/Deletes concentrate circles c-circles.for c-circles.gif
Draws the function y=f(x) function.for function.gif
Plots linear spline functions for the given data file(data.txt) linear-spline.for linear-spline.gif
Plots best fit line for the given data file(data.txt) linear-lsf.for linear-lsf.gif
Plots best fit line for the given data file(data.txt) and creates PostScript file linear-lsf-ps.for linear-lsf-ps.eps

/\ Top

Projects

  1. Plot n-degree polynomial fit function for the given data.
  2. Plot cubic spline functions for the given data.
  3. Plot first and second derivative of a given function.
  4. Plot some interpoltated/extrapolated points for a given data.
  5. Plot 'Histogram' of a given data.

/\ Top


Home | E-mail
Last Modified:Oct-11-2006