[UP]


Manual Reference Pages  - scalg (3)

NAME

scalg(3f) - [M_calcomp:scientific] determine scale factors for a logarithmic scale (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Examples
Example
License

SYNOPSIS

subroutine scalg(array,axlen,npts,inc)

DESCRIPTION

SCALG is a FORTRAN subroutine used to determine scale factors of a data array to be plotted on a logarithmic scale. The scale factors are those used by subroutines LGLIN and LGAXS. SCALG is similar in operation to SCALE.

OPTIONS

ARRAY is the array containing the data to be scaled. The FORTRAN DIMENSION statement must specify at least two elements more than the number of values being scaled, to allow room for SCALG to store the computed starting value and scaling factor at the end of the array.
AXLEN is the maximum length, in inches, over which the data is to be plotted.
NPTS is the number of values in ARRAY to be scaled.
INC is the increment between elements of the array to be plotted. INC is greater than 1 if the values to be plotted are in a mixed or multi-dimensioned array. (Normally INC = 1).

    COMMENTS

The array must be dimensioned with at least NPTS + 2 elements. The adjusted minimum value (FIRSTV) and the delta value (DELTAV) are stored by SCALG in the data array.

The adjusted minimum is stored in ARRAY (NPTS*INC + 1), and the adjusted delta (log cycles per inch) is in ARRAY (NPTS*INC + INC + 1) . Therefore, ARRAY must be dimensioned to be at least NPTS*INC+INC+1 .

Every INCth element of the array ARRAY, beginning with the first, is scanned to find the minimum and maximum values of the array. Next, the greatest value of 10**n (integer n) less than or equal to the minimum value is found and then stored in ARRAY (NPTS*INC + 1). Finally, the smallest value of 10**m (integer m) greater than or equal to the maximum value is established.

The delta value is the difference between the minimum and maximum powers of ten, divided by AXLEN, yielding log cycles per inch. The delta value is stored in ARRAY (NPTS*INC + INC + 1).

EXAMPLES

Various examples:

    A.  For the following array of values

ARRAY(1) = 1500.0 ARRAY(2) = 3000.0 ARRAY(3) = 2500.0 ARRAY(4) = 300.0

and the following argument values

AXLEN = 1.0 NPTS = 4 INC = 1

the adjusted minimum (FIRSTV) and delta value (DELTAV) stored by SCALG are:

FIRSTV: ARRAY(5) = 100.0 DELTAV: ARRAY(6) = 2.0

B. If the value of AXLEN in Example A were changed to 4.0, the resultant values stored would be:
FIRSTV:
  ARRAY(5) = 100.0
DELTAV:
  ARRAY(6) = 0.5
C. For the following array of values
        ARRAY(1)  =    1.2*
        ARRAY(2)  =  100.0
        ARRAY(3)  =    2.3*
        ARRAY(4)  =   88.0
        ARRAY(5)  =    1.8*
        ARRAY(6)  =    0.0
        ARRAY(7)  =    0.8*
        ARRAY(8)  =   10.0
        ARRAY(9)  =    0.7*
        ARRAY(10) =   10.0

and the following argument values:

AXLEN = 10.0 NPTS = 5 INC = 2

the adjusted minimum (FIRSTV) and delta value (DELTAV) are determined from the value of the asterisked items (1, 3, 5, 7, and 9) in the above array. The computed values are also stored two subscript elements apart.

FIRSTV: ARRAY(11) = 0.1 DELTAV: ARRAY(13) = 0.2

EXAMPLE

Sample program:

   program demo_scalg
   use M_calcomp
   implicit none
   ! based on concepts of CALIFORNIA COMPUTER PRODUCTS, 1968
   character(len=50) :: ibcd
   integer           :: i, k
   integer           :: inteq
   real              :: a
   real              :: angl
   real              :: angle(19)
   real              :: bang
   real              :: beta
   real              :: r(19)
   real              :: theta
   real              :: x
   real              :: xx
   real              :: xa,ya, xb,yb, xc,yc, xd,yd
   real              :: xar(8)= [ 1.00, 2.00, 3.00, 4.00, 5.00, 6.00       , 0.0, 0.0 ]
   real              :: yar(8)= [ 250.0, 110.0, 500.0, 900.0, 200.0, 140.0 , 0.0, 1.0 ]
      call plots(0.0,10.0,0.0,10.0)
   ! DRAW FRAME
      call plot(7.0,0.0,2)
      call plot(7.0,9.0,2)
      call plot(0.0,9.0,2)
      call plot(0.0,0.0,2)
   ! DRAW COMMENTS
      ibcd=’USING SCALG, LGAXS, AND LGLIN SUBROUTINES’
      call symbol(0.7,8.25,0.14,ibcd,inteq,0.0,42)
      ibcd=’USING POLAR SUBROUTINE’
      call symbol(0.7,3.80,0.14,ibcd,inteq,0.0,22)
   ! AXIS IS DRAWN
      ibcd=’ALTITUDE’
      call axis(1.0,4.75,ibcd,-8,5.0,0.0,0.0,25.0)
      call scalg(yar,3.0,6,1)
      ibcd=’TEMPERATURE’
      call lgaxs(1.0,4.75,ibcd,11,3.0,90.0,yar(7),yar(8))
      call scale(xar,5.0,6,1)
      call plot(1.0,4.75,-3)
      call lglin(xar,yar,6,1,0,1,1)
      call plot(-1.0,-4.75,-3)
   ! POLAR SUBROUTINE IS USED
      x=0.0
      do k=1,19
         theta=x*0.0174533
         r(k)=2.0*(1.0-cos(theta))
         angle(k)=theta
         x=x+10.0
      enddo
      call plot(5.0,0.75,-3)
      call polar(r,angle,19,1,0,1,0.0,1.0)
      angl =30.0
      a=1.0
      do  i=1,5
         theta=angl *0.0174533
         xa=cos(theta)
         ya=sin(theta)
         call plot(xa,ya,3)
         xb=1.1*xa
         yb=1.1*ya
         call plot(xb,yb,2)
         xc=xb+0.05*xa
         yc=yb+0.05*ya
         if((i-3).gt.0)then
            a=1.5
         endif
         beta=1.570797-theta
         xd=xc-0.105*a*cos(beta)
         yd=yc+0.105*a*sin(beta)
         bang=270.0+angl
         call number(xd,yd,0.105,angl, bang,-1)
         angl =angl +30.0
      enddo
      xx=0.0
      do i=1,19
         angle(i) = xx*0.0174533
         r(i) = 1.0
         xx=xx+10.0
      enddo
      call polar(r,angle,19,1,0,1,0.0,1.0)
      call plot(-5.0,-0.75,-3)
   ! AXIS IS DRAWN
      ibcd=’’
      call axis(1.0,0.75,ibcd,-1,4.0,0.0,4.0,-1.0)
      call axis(5.0,0.75,ibcd,-1,1.0,0.0,0.0,1.0)
      ibcd=’RADIUS=2*(1-COS(ANGLE))’
      call symbol(3.75,3.5,0.09,ibcd,inteq,0.0,23)
      call plot(11.0,0.0,999)
   end program demo_scalg

LICENSE

Public Domain


scalg (3) March 11, 2021
Generated by manServer 1.08 from 96e47fbe-9582-43ad-bc5e-8f6ce64abfb0 using man macros.