Lab Assignment 6

The purpose of this assignment is to make you use PGPLOT. The following instructions may be useful.

  1. From the course homepage download (from the Sample Code link) the following programs
    1. pdgdemo.f90 (3 simple demos)
    2. knightplot.f90 (knight's tour using PGPLOT)
    3. projectile.f90 (projectile trajectory plotting)


  2. Try out the above 3 programs. To do this run:
          pgcompile  pgdemo  pgdemo.f90
          ./pgdemo
    
    for running the 3 demos. If you have difficulty with X-windows, ask the TA or fellow students for help.

  3. Write your own program that will read in a polynomial from the user and plot it on the screen.

    One simple way is to assume that all polynomials are degree 5 and if the user inputs

          3 0 -2 0 1 4
    
    she wants the polynomial
         3 x^5 - 2 x^3 + x + 4
    
    plotted. Feel free to improve this (degree, representation) and also try and allow more than one polynomial to be plotted (change colour) on the same screen. Try and be flexible with the axes and labelling also.