X*EXP(-4.4*X)
then a graph of the function
would be plotted over the
range
.
\verb#* Declare variables.
INCLUDE 'SAE_PAR'
INTEGER NPTS
PARAMETER ( NPTS = 1000 )
INTEGER STATUS, ID, IPOINT
REAL X( NPTS ), Y( NPTS )
CHARACTER EXPRS * 80, FOR( 1 ) * 82, INV( 1 ) * 1
CHARACTER * ( DAT__SZLOC ) LOCTR
* Obtain an expression and formulate the transformation functions.
CALL PAR_GET0C( 'EXPRESSION', EXPRS, STATUS ) [1]
FOR( 1 ) = 'Y=' // EXPRS
INV( 1 ) = 'X'
* Create a temporary transformation and compile it.
CALL TRN_NEW( 1, 1, FOR, INV, '_REAL:', [2]
'X --> f( X )', ' ', ' ', LOCTR, STATUS )
CALL TRN_COMP( LOCTR, .TRUE., ID, STATUS )
* Set up the X values, then transform to yield the Y values.
DO 1 IPOINT = 1, NPTS
X( IPOINT ) = REAL( IPOINT - 1 ) / REAL( NPTS - 1 )
1 CONTINUE
CALL TRN_TR1R( .FALSE., NPTS, X, ID, Y, STATUS ) [3]
* Plot the graph and clean up.
CALL GPL( NPTS, X, Y ) [4]
CALL DAT_ANNUL( LOCTR, STATUS ) [5]
CALL TRN_ANNUL( ID, STATUS )
Programming notes:
).
TRANSFORM Coordinate Transformation Facility