CALIFORNIA STATE UNl 'IJI"RS ITY, NORTIIH lDGI:
APPROXIMATION:METHODS USING
I
I
-q
~RBITRARY
FUNCTIONS:
S''J:READ
<.:.DECTRUM r')~vl\!flN'C!\TION
TFCTTNTOP'.''
.r ..~. . . . .
~-.l
,l . . ~-- ~./~ J ..Jl
.
_1_1 -'-, J •.J.)
...J
1
__
l
.
A graduate project su~nitted in partial
satisfaction of the r~quirements for
the degree of Master of Science in
• i
i
I
I
I
Engineer iiJ.g
by
DanieJ Hen1y Crcnin
I
I
I
I
I
I
I
I
I
'
I
. I
May, 197 5
-I
t
I.
IL _____ .,________,_,______.._____________..___
~---------------------·----
....··------------------·----------· ..... --------·---------------···
The graduate project of Daniel Henry Cronin is approved:
~tee
Chairman
California State University, Northridge
May, 197 5
ACKNOWLEDGEMENT
~he
author wishes to thank
J~
Simmons and V. Woolman
of the Pacific Missile Test Center and L. Nypan of the
California State
University~
Northridge, for their aid and
support on this graduate project.
iii
A}?STRACT
APPROXlivfATION·~ri~THODS USING ARBITRARY FUNCTIONS;
SPREA.I) SPECTRUM COlvfMUNI CAT I ON TECHNIQUES
by
Daniel Henry Cronin
Master of Science in Engineering
May, 1975
This graduate paper is the result of two work projects undertaken at the Pacific Missile Test Center.
The
first project involved an evaluation of several computer
program~
which approximate functi611s of several variables
!bY sums of functions of fewer variables.
Short descrip-
tions of these programs are presented with some suggested
applications.
The second project is concerned with spread spectrum
communication techniques, which are used for tactical military communication.
An introduction to the subject is
presented.
-------------·--..------iv
PART I
APPROXIMATION METHODS USING ARBJTRARY FUNCTIONS
i
I
I
--------------··----·--····----·-·-··------J
v
....,.
TABLE OP CONTENTS
-~-}
P/\GJ~
ABSTRACT . .
iv
INTRODUCTION
1
2.0 ARBITRARY FUNCTIONS
1
3.0 METHODS OF PIKE AND SILVERBERG
2
4. 0 SUMMARY OF COMPUTER PIWGRAJv1S AND THEIR APPROXJMAT ION TECHNIQUES
4.1 APPROX I
4
.
4
I
i 4. 2 APPROX II
7
4.3 MINMAX
9
4 . 4 LSTSQ
11
4.5 LEAST-SQUARES TECHNIQUES
L5
. . . . . .
14
6.0 CONCLUSIONS AND COMMENTS
17
5.0 APPLICATIONS
REFERJJNCES
APPENDIX
.
.
.
18
.
19
vi
t;
)
1
.l
1.0
INTRODUCTION
Several specialized computer programs have been
developed for-approximating functions of several va1·iablcs.:
These~m---e-
Fortran IV language prot_;rams called APPROX 1,
APPROX II, MINMAX, and LSTSQ.
This paper is intended to
give the reader some insight into the operation of the
approximation methods and, thus, to enable him or her to
use the above computer programs effectively.
The nature of:
!the approximation techniques implemented by the programs,
1 11e
't-1-
essentials of using the progTruns, and some applications!
land
comments are pTesented.
;
t
MINMAX programs
The APPROX I, APPROX II, and
as used for particulaT data sets are listed!
in the appendix.
I
The LSTSQ program is listed in Franke 1 .
These computer programs were develo~ed to approximate
aerodynamic coefficients.
The aerodynamic coefficients
used in this pToject are functions of four variables:
angle of attack, wing deflection, mach number, and bank
angle.
They are obtained for particular missiles and for
particular values of the independent variables from wind
tunnel measurements.
I
I
The coefficients are used in computer!
simulations to calculate the forces and torques on a
missil~
in flight.
2.0
ARBITRARY FUNCTIONS
The computer programs APPROX I, APPROX II, and MINMAX
produce approximations that, unlike least-squares methods,
are
~o t
con t inuou
~--:''met ions .
The
1
_fun::~.:'.n s '11<l_t_=_on s~~t_u t j
~.
l
..
)
the approximations are called arbitr3ry functions.
tinuous representation of the
assumed to
exist~
~ubitrary
,\ con-
function is
but this continuous form is never cxpfi-
The computer programs produce arrays of
citly stated.
numbers which are the values of these functions evaluated
at several discrete values bf their independent variables.
The approximation techniq'ue s implemented by the s c programs also do not use the actual values of the independent
variables to derive the approximations.
Thus, the func-
tions derived are also arbitrary with respect to their
independent variables.
The original function, then, need
not be evaluated at equally-spaced values of its independent variables to use these computer programs.
APFROX I, APPROX II, and MINMAX compute approximations of multi-variable functions which are sums of
arbitrary functions of fewer variables.
- ----~-tiohsh.avetlfe-advarrtage
I storage
Such approxima-
or :Te-ducingt-he
amoun-te-f-c::-empHt.e.:r--
needed to represent a function.
For example. a
i
I ::::::o:no:.::r::d::::::::·:.:::~::·::q:::::·::: ::o:::c
i
spaces to store in a computer.
! of
I
A representation consisting
a sum of three one-variable functions, however, uses
only 10
+
10
+
10 • 30
storage spaces.
Other examples are
l given in Franke.l
I 3.0
I
METHODS OF PIKE AND SILVERBERG
~---~~Th: ~PP~OXJ,~and~~PPR~~II ~pr:grams
are
dcs.igncd to .
.J
derive approximations us1ng similar techniques to those
discussed in Pike and Silverbcrg
2
. These techniques arc
claimed to minimize the total squared error, i.e.
least- squares techniques.
they (lre
As an example of this method,
consider approximating a function of three variables,
F(xi,Yj,zk), by a sum of three one variable funct_ions,
f1Cxi) + fz(Yj)
+ {3(zk).
To obtain the first function
solve the following equation for all i:
values of the x, y, and z independent variables, respectively.
are not functions of f1Cxi),
so the result
i~:
Nl<
L ~,(xi,
Yj, z1d- fz (Yj)- f3 (zkJ]
k:::J
The assumption that F(xi,Yj ,zk) is not a function of
f1(xi)
is incorrect.
Taking the correct partial deriva-
tive above, the equation becomes:
~
~
>-
~
j.=l
k::l
.
[F (xi ,yj, Zk) -fl (xi) -fz (Yj) -f3
To evaluate the
I
1
-~L)
term.~-(
0 -ti
)'(!..
(zkJ[~'j>~ t~;J- 1]=0,
the function f1Cxi) must be
known a priori of the derivation, which is not possible
s1nce it is an arbitrary function.
Hence, the correct
partial derivative cannot be computed.
l
As a result, the
approximations discussed by Pike and Silverberg will drive
only one of the two terms of the correct derivative to
~-
-------~
~·
--------
-~-
--------
---·---------·----·
·-
----·
··- -·-----
The approximations derived by Pike and Silverberg arc
simply the arithmetic means of the original function with
i
variables fixed for an approximating function of i vari-
ables.
For this type of an approximation, the var:iancc of
lthe original function about the approximating functions
individually is
min~J]izedo
A computer program was written using the same technique of Pike and Silverberg to approximate a function of
three variables:
F(xi,Yj,zk), by the following sum of
arbitrary functions:
Unlike APPROX I and APPROX II this is an iterative techlnique.
Several sample functions were approxjmated.
In
I
general, the RMS (root-mean-squared) error approached a
non-zero_ limit asymptotically and the maximum error did not
converge.
4.0 SUMMARY OF COMPUTER PROGRAiV1S AND THEIR APPROXIMATION
TECHNIQUES
4.1 APPROX I
The APPROX I program will produce an approximation to
functions of up to three variables of the following form:
I
I
- - - - - - - - - - · - - - - - - - - - - · - - - - · - · - - - - - - - - - - - - · - · - · · - - · · · - ·-·-·······7······· . - · ... ·•.
·····-······-··--·--J
s
where the fi,
gi, and hi are arbitrary functions of one
variable . . The method used to obtain the appro:dnwti.ons is
similar to that discussed by Pike and Silverberg.
first function derived, f1Cxi),
The
is found by solving the
]following equation while ignoring the partial derivative
i
lof F(xi,yj,zk) with respect· to f 1 (xi):
L__
0 f,[::<i)
;;-
(:=;;I
,j::. I
>=
N,,
~
N:r
N:r:
[FCxi ,yj ,zk)-f 1 (x 1 -)]2
0
k~J
The result is
i fl (xi)
=
-iv;:;---
The second
1
found similar-
1y by solving
lfor g 1 (y.), again ignoring the differentiation of
•
J
!F(xi,yj,zk) with respect to g 1 (yj).
N:r:
: gl ( y j ) ==
1
-
I
I!are
Nr
.
L
i_=:: I
So
Nk
L
K:: I
[!cxi,Yj,zk)-f 1 Cxi)]
The remaining functions h1, fz, gz, hz, ... £6, g6, h6
found by a similar analysis, until £6, g6, and h6 are
l
~found by operation on the residual array from previous
I
1
•
•
approxJ.mat1ons.
!
The inputs and outputs of the program are listed in
1
table I.
The independent variable values input are not
!used in the derivation of the approximations, but for
!labelling the output.
l_ __
The pr.ogram is writ ten to accept no more than fifteen
-·-
u
TABLE I
THE APPROX I COMPUTER PROCRM1
Data Inputs:
1)
2)
3)
4)
Original function array
Independent variable values
Namber of points at which the original function
is- sampled in e_ach _i_ndependent variable
Titles for output labelling· ---
Outputs;
1)
£)
3)
4)
5)
6)
Original function array
Independent variable values
Approximating functions
Line-printer plots of approximating functions
Residual arrays after subtracting the mean of the
~riginal function! the sum ~1Cxi) + gl(Yj) + h1
lzk)~ and the ent1re approx1mat1on
Several statistics at each of the points of the
program mentioned in (5) including the maximum
absolute error and the RMS error
Options:
1)
The user may specify any of the one-variable
approximating functions to be sampled functions
of his or her choice.
2)
The user may extend the approximation derivation
beyond the functions f6, g6, and h6 by changing
the limit of the variable NPROD.
l__ ------------.---·------·--------------- - ·--------- - - - - - · - - -·-·. · - ·-
.... -····
_
_____ . __)
7
·s-;;1-pij_-~g--p~i~t~----i;;-·-;;-~h-i-;d;p~-~d~-;;t·'"-v a;·;-~bT~-:--- .T~---i·;;~~-;;;-~-;--l
this cap~city of the program, it was £ound, would require~ \
changing a considerable number of statements.
Even minor
I
I
modifications may require changing several statements in
I
I
. many sections of the program.
4. 2
I
I
\
\
APPROX II
The APPROX II program will approximate a function of
II
up to four variables, F(xi,Yj,zk,wl), with the following
sum of arbitrary functions:
£ (yj)
2
+
+
£ 3 (zk)
+ fl4(xi,wl)
+
+
f 4 (w 1 ) +
f23(yj,zk) +
The method used to obtain the approximating functions
1s simil_ar to that of APPROX I.
The first function
derived, f1Cxi), is:
f
fl(xi)
=
N
I
-!VI\
J
NL
j'
Nt<
Nc..
? L L. ~(xi,Yj
llr
p: l
f>.:;l
,zk,w 1 )-F]
~::1
where F is the mean value of F(xi,Yj,Zk,wl).
Then fz(Yj) is obtained
I
N:x: Nk Nt _
- "*'
..
I - I
fz(y·) = - - - N~.- LL~~Cxi,Yj,zk,wl)-IJ
J
N;r Nk.
[:::1
f<::: I
.{::I
The two-variable functions of the approximation arc
derived similarly from the residual array
------·-----·----·--------------------------------
8
TABLE II
I
THE APl ROX I I Co:t-.1PUTER PROGRAiv1
1
Data Inputs:
1)
2)
Original function ar~ay
Number of points at which the original function
is sampled in each independent variable
Outputs:
1)
2)
3)
4)
5)
Original function array
Mean value of the original function
Approximating functions
Residual arrays, maximum error, and RHS error
after stilitracting the mean value, the onevariable approximatjng functions, the twovariable approximating fun~tions, and the threevariable approximating functions
Variance table of the original function and all
the approximating functions
l
lI
I
I
I
9
r
·.
.
. -------·--·-· .
-----~-----~-------~-----------·----------------------~-----·--·------------ --~-'----
-----~---·:-
......
-----------~-
[F (Xi ' y j ' Z k ' W1) -f. - f 1 (Xi ) - f 2 ( y j ) - f 3 ( Z k) - f4 ( W 1 )]
1
.-,,
!Then the three variable approximations are derived from
'the residual array
[FCxi,Yj ,zk,wl)-F··fJ(Xj)-fz(Yj)-
f3(zk)-f4(w 1 )-fJz(xi,Yj)-fJ 3 (xi,zk)-f 1 4Cxi,w 1 )-fz3(Yi,2k)-
.f2~(yi,wl)~f34(zk,wl8
I
The inputs and outputs of APPROX JI are listed in
table II.
The program is sufficiently well documented
jwith comment statements to allow easy modification of the
!parameters or the flow of the program.
l
14.3
MINMAX
The MI.t\1£-1AX program will approximate functions of up
to five variables with either a sum of one-variable
I
.
jfunctions or a sum of two-variable functions,
I.e.
,.J
F(xi,Yj,zk,v 1 ,wm)
==
f 1 (xi) + f 2 (yj) + f 3 (zk) +
I
lf4(v 1 ) + f 5 Cwm) or f 12 Cxi,Yj) + f 13 (xi,zk) + £ 14 Cxi,v 1 ) +
I
flsCxi,wm) + fz3(Yi,zk) + fz4(Yj,vl) + fzs(Yi,wril) +
f34Czk,vl) + f3sCzk,wm) + f4S(vl,wm).
This approximation technique minimizes the max1mum absolute error.
The method used to derive the approximating functions
is discussed by Franke 1
Essentially, the one-and two-
variable functions are a:crages of the original function
values with one and two of the independent variables, re__
:~-~-~-~ v: y~_:~~e
i
1
d ._Th :_•
I
1.
v~:~~~-~:~_ :_:r_i~~h~e-~~c--m-e ~nJ
10
r·--·---~-----~-----------------------------------------------------·-····---- -~-----~-
----- -
I
TABLE III
THE MINrv!AX CUMPUTER PROGRATvl
Data Inputs:
1)
2)
Original function array
Number of points at which the original function
is sampled in each independent variable
Outputs:
1)
2)
3)
4)
S)
Origjnal function array
Approximating functions
Number of iterations performed
Residual array
Maximum error and RMS error
Options:
1)
2)
Choice of approximation by sum of one- or twovariable arbitrary functions
Choice of having the residual array, maximum
error, and RMS error output at each iteration
I
--··---------~------------------------------·--------.----J
11
·-·-------------..-· ---·-···· ........
r
however.
-----~---·-
-- --------·-------·-----------..
~-
-------· -------------
...... ,.
,.,
_______....____ ---·----- ---,
It is the average value of the maximum and
mini~
mum values of the original function over the limited
domain resulting from fixing one or two independent' vari- l
ables.
[
The computation of the approximation is an iterative i
f
-
I
process, computing the functions in sequence and subtract-!
l
ing them from the previous
re~idual,
then using this
residual to compute the next function.
i
i
!
The user can limit!
the number of iterations by changing.the value of the
II
I
variable ITMAX.
The program will stop also if the maximurni
of the absolute value of the variable FV is less than the
Ii
variable EPS.
I
FV 1s the average of the maximum value and
the minimum value
used in computing the approximating functions.
FV is
calculated for all combinations of the independent variables of the approximating functions.
FV will decrease at!
each iteration since succeeding approximations are better
representations of the original function with respect to
the rninmax criterion.
EPS, the constant upper limit of
FV, can be changed by the user.
The inputs and outputs of MINMAX are listed in table
III.
For a more detailed discussion of the program see
Dr. Franke's report.
4.4 LSTSQ
I
12
TABLE IV
THE LSTSQ COMPUTER PROGRAM
Data Inputs:
1)
2)
3)
4)
5)
Original function array
Independent variable values
Number of points at which the original function
is sampled in each independent variable
Three functions of factored out variable
If weighting option is used, weights on each
independent variable
Outputs:
1)
2)
3)
4)
5)
Original function array
Independent variables and weights assigned to
them
Residual array
Coefficients of the three functions· of the factored out variable
Maximum error and RMS error
Options:
1)
2)
3)
4)
Weighting option
Choice of which independent variable is to be
factored out
A search option for the independent variable
which will yield the approximation with the
smallest RMS error and output this approximation
An option to compute and outppt the approximation,
in each independent variable
I
l
I
I
·--------------·
-------·----·--·---_j
one of the independent variables is factored out in three
functions of the user's choice.
For example, a function
mated by the following sum:
3
~
F(xi,Yj,Zk,tl,vm,wn) ~
[ Ap (xi , y j
~ zk , t 1 , v m
) f p ( wn
J]
'('::I
where w is the variable factored out and the fp(Hn),p
1,2,3~ are function~~chosen by the user.
The program will
solve for the arrays Ap,P = 1,2,3, so that the total
squared error
AD
lS
~
:1
m:tHlmJ.ZE:Ci.
•
listed in table IV.
-
•
The inputs and outputs are
Sec Frankel for a more detailed dis-
cuss ion.
4.5 LEAST-SQUARES TECHNIQUES
1
I
Several programs are available for least-square curve-'
!fitting.
The author used the CURFIT set of subroutines
developed by Archer 3. A program using Archer's subroutines:
i
to curve-fit multivariable functions by polynomials was
developed by Walter 4. Townsend5 modified Walter's program
i
and used it to study the accuracy and hybrid computer
i
l
i
implementation of several polynomial curve-fits of functiom!
I of three variables.
The least-squares curve-fitting
techniques of the Scientific Subroutine ~ackage6 are also
available.
The advantages of the least-squares programs are that
the approximations minimize the total squared error, and
l
\
14
discussed earlier.
:;.I
0 n e d i s a dv ant age o f us J. n g 1 e as t - s q u are s rout inc s
1
s
i
jthat the functional form of the approximation must be
!chosen a priori.
lmetcrs of
These techniques solve for the para-
ihe approximation.
Arbitrary function approxi·
I
jmations are more flexible in this regard.
I
I
Also, for some applications it is necessary to have
ian approximation that consists of a sum of only a few
Iterms.
Without descriptive information about the data, it
I
lis difficult to choose a functional form for such an
!approximation that meets the user's accuracy requirements.
ls.o APPLICATIONS
!
The APPROX I, APPROX II, and MINMAX-programs are not
I
lrowerful approximation techniques.
!they compute
a~e
The approximations
not continuous functions, do not minimize
!the RMS error, in general, and are simply averages of the
original. function values.
They may be of some value for
approximating the residual resulting from another approximation technique.
The additional accuracy gained may be
worth the added computer storage required.
As an example, Data Set III, listed in Frankel, was
curve-fit linearly in the three independent variables, and
the residual was approximated by MINMAX with first a sum
of three functions of one variable, and then a sum of
three functions of two variables.
The results arc:
i
..
·- ....
--
I
____ _j
I5
Data Set III
l
I
!
Maximum Error
Approximation by CURFIT
.745
. 177
With residual approximation
by MINMAX, functions of one
variable
.448
.150
With residual approximation
by MINMAX, functions of
two variables
.164
.078
The number of extra memory locations needed to store the
residual approximations
ar~
38 and 429 for the one- and
two-variable functions, respectively.
The APPROX I, APPROX II, and MINMAX programs can also
be used to examine the topology of the original function.
'The line-printer plots of the APPROX I program will give
II
cross-sections of the original function.
Plotting the
I approxjmatjng functions of the other programs will also
!provide some information about the variation of the
Ij original
function with its independent variables.
These
'plots can be used to conjecture analytic functions which
/would yield an accurate curve-fit when used in a least1
squares curve-fitting program.
.
The functions output by the APPROX I, APPROX II, and
MINMAX programs are not constructed to minimize the RMS
error.
However, the RMS error can be reduced by using a
I least-squares
r
program to find an approximation linear in
the one-variable functions.
III of Franke.
This was done with
Dat~ Set
The original function of three variables,
F(xi,Yj,zk) was first approximated by a sum of three one-
16
fl"C~i-,-)~j ,;k)-~ f1Cxi)
i By
I
+
fz(Yj)
+
f~;;(zk)
using a least-squares progrnm, constants b 1 , b 2 , and
lb 3 were found so that the approximation F(xi,Yj ,zk) -
error.
The results arc:
Data Set I I I
Maximum Error
RivlS Error
MINMAX approximation
by sum of one-variable
functions
. 4 48
.153
Least-squares approximation using MINMAX
functions
.563
.142
Such a combination can also be used to reduce the RMS
error of an approximation consisting of a sum of arbitrary
functions of more than one variable.
The LSTSQ program is the most versatile technique of
'
i
'lthose discussed by Franke.
It has the reduced storage
I
!I advantage of the APPROX I, APPROX I I, and MINiv1AX programs
land minimizes the total squared error for the three
!functions provided by the user.
I
In addition, for hybrid
!computer implementation of the approximation, the three
l!functions
0
can be evaluated in the analog domain and their
I
!coefficient arrays evaluated in the digital domain"
1
The LSTSQ program can be used sequentially to approx-
1
limate the residual of a previous LSTSQ approximation.
this way an
~pproximation
can be attained which factors
out one variable in more than three functions, or which
[
factors out more than one variable.
-·--·---·---------:-----,.-------------·--·- -----·----------------·-·- -- -·-- ,_.
------·-
In
l7
f 6·-:-o-cc)ik:I~-tTs-i6Ns--At~n-~co~i~1-EN1~s-1
-------- -- ---··-· -- -·
The APPROX I and APPROX II computer programs were
I!shown
to produce approximations that do not minimize the
i
!total
squared error.
I
Some comnents were made about the
I
!accuracy characteristics of these methods, however, more
!analysis is needed to make definitive statements about
I
i
!them.
Nevertheless, these programs can be used in combjna-
\
!tion with least-squar-es programs to reduce the RMS error
las was done with MINMAX approximations in the previous
I
I
.
i sectJ.on.
I
l(be
The arbitrary function techniques discussed should
useful for investigating the topology of sampled func-
!
)tions of several variables.
Examination of the output of
the APPROX I, APPROX II, or MINMAX programs will provide
the user with some information about the relationship between the original function and each independent variable.
:These
relationships can be
I
I
e~plored
more precisely by using
.
lthe LSTSQ programs with appropriate choices for the one-
lvariable functions input by the user and use of the several!
options available.
In combination with least-squares methods the APPROX
,I, APPROX II, MINMAX, and LSTSQ programs provide the user
!
!with some approximation methods which differ in functional
i
form,
theoretical technique, and computer hardware imple-
mentation.
i
i
......J
J,
REFERENCES
1.
Naval Postgraduate School.
Some Methods for Approximating Functions of Several Variables, by R. Franke.
Monterey~ California, May, 1974.
(NPS Technical Report
No. NPS-53Fe74051).
UNCLASSIFIED.
2.
Pike, E. W. and Silverberg, T. R., "Designing Mechanical
Computers. Part 1 ,Functions Having Two Variables," July,
1952, pp 131-137, and "Part II, Functions Having ivlore
Than Two Independent Variables," P:ugust, 1952, pp. 159163. Machine Design.
3.
Naval Missile Center.
Least Squares Curve Fitting by
Computer, by C. 0. Archer.
Point Mugu, California,
Naval Missile Center, 20 January 1967.
(NMC Technical
Memorandum TM-66-59.) UNCLASSIFIED.
4.
Systems Evaluation Division.
Curve-fitting Two, Three,
and Four Dimensional Sets of Data Points by Method of
Least Squares, by B. Walter, Point Mugu, California,
Systems Evaluation Division, 20 April 1967.
UNCLASSIFIED.
5.
Systems Integration Division.
Curve Fitting Aerodynamic Coefficients of Three Variables, by R. Townsend,
Point Mugu, California, Systems Integration Division,
July, 1968.
UNCLASSIFIED.
!6.
International Business Machines Corporation.
IBM
Application Program.
System/360 Scientific Subroutine
Package (360A-CM-03X) Version III, Programmer's Manual.
i
iI
l
I
I
I
I
I
ii
I
[_ ____________________ ______ ·-- '·---------·-----·-- ·--·------····-·--···· -,.
-
19
APPENDIX
A.l
APPROX I
i\IAINPROGRAM APPROX
INTEGER REMAIN
REAL NFLSCA
COM\I'!ON/ ZILCH/ R (15, 1 5, 15) ,.Ilv1AX, JMAX, KMAX, i\j\11\X, Bl\!AX,
CMAX,SCALE
COMl\10N/BLAPP/1;l(lS) ,Gl(lS) ,Hl(l5) ,FlA(lS)
COM.MON/WHORT/F4(15) ,G4(15) ,H4(15) ,F4A(l5) ,G4A(l5),
H4A(l5)
COMMON/LAWLFE/XAXIS(lS), YAXIS(lS) ,ZAXIS(l5) ,XNAf.lE,
YNAME,ZNAME,PRIN
*1'(17)0)
CO!v~ON/TITLE/TTl,TT2,TT3
I~
c
c
C
c
C
DIMENSION X(lS)
READ FUNCTION NAME AND CONDITIONS
READ(5,6) TTl,TT2,TT3
6 FORMAT (3A6)
WRITE (6,7) TTl,TT2,TT3
7 FORl'viAT (HI, 3A6)
READ IN ARRAY DIMENSIONS, SCALE FACTOR, AND VARIABLE
NAMES
READ ( 5, 1 0) AMAX, BMAX, C.M_,<\X, SCALE XNAME, YNAME, ZNAME
10 FORMAT (4Fl0.0,3A6)
WRITE ( 6, 8 0) Aj\fAX, Bl\IAX, CMAX, SCALE, XNAlvlE, YNAME, ZNAiv!E
80 FOR!v1AT (1Hl,4(1X,FS.2),3(1X,A6))
I Iv1AX= AMAX
THIS IS A DUMB-DUMB CARD ........ .
Jf\'lAX=BMAX
KMAX=CMAX
INITIALIZE ARRAYS TO ZERO
DO 20 I=l,lS
DO 20 J==l,l5
DO 20 K=l,lS
R (I, J, K) = 0.
c
C
Fl(I)==O.
FlA(I)=O.
G1(J)=O.
Hl(K)=O.
20 CONTINUE
READ IN AXES VALUES FOR PRINTER PLOT
READ(5,100)(XAXIS(KK),KK=l,IMAX)
READ_( 5,10 0) (YAXIS (KK), KK= 1, JMAX)
20
-----·-·~.... ---.--...---·---""-__..,---------·--~~-· ~-~-·-·.. <--···---~-~ ...-.. --------·--'-"·-~--~---··----·- -··--·~-·-------- -·
READ(S,lOO)(ZAXIS(KK) ,KK=l,KMAX)
FORMAT(8F10.3)
100
WRITE (6,70) XAXIS(KK) ,YAXIS(KK) ,ZAXIS(KK),KK=l,lS)
'10 FOR!'v1AT (1H,3(5X,Fl0.4))
""!
I
.
c
C READ DATA CARDS
I1200 READ(S,l)FXXXX,GYXXX,HZXXX,COEF
FORfvlAT ( 4F1 0. 3)
IF(FXXXX.LT.O.) GO TO 600
DO 2 I=~l, IMAX
L=I
c
REARRANGE ORDER OF APPROXI.MATING THE ARBITRARY FUNCTIONS
WHERE FXXXX,
GYXXX AND HZXXX REPRESENT F(X), G(Y), AND H(Z), AND
XXX3,XXX1,XXX2
IS THE ORDER OF THE VARIBLES ON THE DATA CARDS
2 IF(FXXXX.EQ.XAXIS(I)) GO TO 21
IF(FXXXX.NE.XAXIS(L)) GO TO 200
21 CONTINUE
DO 3 J=l,JMAX
M=J
3 IF(GYXXX.EQ. YAXIS(J)) GO TO 31
IF(GYXXX.NE. YAXIS(M)) GO TO 200
31 CONTINUE
DO 4 K=1,KMAX
N=K
4 IF(HZXXX.EQ. ZAXIS(K)) GO TO 41
IF(HZXXX.NE. ZAXIS(N)) GO TO 200
41 CONTINUE
R(L,M,N)=COEF
GO TO 200
600 CONTINUE
C MULTIPLY DATA BY SCALE FACTOR
DO 40 I=1,15
DO 40 J=l,lS
DO 40 K=l,lS
R(I,J,K)= SCALE*R(I,J,K)
40 CONTINUE
.
c
C
DETERMINE THE FULL-SCALE RANGE OF THE DATA
NFLSCA=O.
PFLSCA=O.
DO 700 I==l,I.MAX
DO 700 J=l,J1v1AX
DO 700 K=l,KMAX
IF(R(I,J,K) .LT. 0.) GO TO 660
PFLSCA=A}~Xl(PFLSCA,ABS(R(I,J,K)))
GO TO 700
66 0 NFLSCA= Al'-1AX1 (NFLSCA, ABS (R (I, J, K)))
700 CONTINUE
:
\
i
? .,
... .L
FLSCAL=PFLSCA+NFLSCA
c
C WRITE OUT THE ORIGINAL DATA ARRAY
REMAJN=O
CALL REMANE(REMAIN,FLSCAL)
DO 11 I5=1,15
DO 12 16=1,15
12
CONTINUE
11
CONTINUE
,i
c
C
I
SUBTRACT OUT THE MEAN
CALL CONST
('
'-'
C WRITE THE FIRST RE.tv!AINDER
REMAIN=1
CALLREMANE(REMAIN,FLSCAL)
I!Ccc
I
I~
Gl AND Hl HAVE BEEN INITIALIZED TO ZERO
SET ITERATION COUNTER
NUMITR=O
COMPUTE F1
DO 1 0 2 0 I= 1 ' IMAX
Fl(I)=O.
DO 1010 J=l,JMAX
DO 1010 K=1,KMAX
F 1 (I ) =R (I ' J ' K) - G1 ( .J) - Hl ( K) .
1010 CONTINUE
Fl(I)=Fl(I)/(BMAX*CMAX)
1020 CONTINUE
I 10 0 0
I
I
I
I
.
c
c F CANNOT BE FIXED 'HERE SINCE CONVERGENCE TEST MADE ON F
c
c COMPUTE G1
DO 1040 J=l,JMAX
G1(J):.::O.
DO 1030 I=1,IMAX
DO 1030 K=1, K.tv1AX
Gl(J)=R(I,J,K)-F1(I)=H1(K)
1030 CONTINUE
G1(.J)=Gl(J)/(AMAX*CMAX)
1040 CONTINUE
c
C INSERT FIXED G1 HERE IF DESIRED
c
c COMPUTE H1
DO 1060 K=1,KMAX
Hl(K)=O.
DO 1050 I=1, IMAX
DO 1050 J=l,JMAX
H1(K)=R(I,J,K)-F1(I)-Gl(J)
1050 CONTINUE
22
Hl(K)=H1(K)/(AMAX*B~~X)
:(.1
c
1060 CONTINUE
C
c
INSERT FIXED H1 HERE IF DESIRED
C TEST FOR CONVERGENCE
c
CALL RELAIR (F1, F1A, RELERR, JMAX)
DO 1 0 71 I== 1 , !)I lAX
F1A(I) =F1 (I)
1071 CONTINUE
C ADVANCE ITERATION COUNTER
NUMITR=NUMITR+1
c
!C
I
I
IF (NUMITR.LT.10) GO TO 1000
IF (NUMITR.GT.200) GO TO 9000
IF (RELERR.GT.0.0001) GO TO 1000
COMPUTE SECOND REMAINDER
2501 CONTINUE
DO 1130 I=1,I~~X
DO 1130 J=1,JMAX
DO 1130 K=1,KMAX
R(I,J,K)=R(I,J,K)-F1(I)-G1(J)-Hl(K)
1130 CONTINUE
c
WRITE (6,1080) NUMITR,SCALE
1080 FOIU.~T (1H1,29HTHE ADDITIVE FUNCTIONS AFTER ,I3,28H
ITERATIONS, SC
*ALE FACTOR= ,F8.3)
c
C NORMALIZE F1
CALL BIG (Fl,BIGGST)
WR1TE (6,1090) BIGGST
.
1090 FORMAT (1H0,10X,25HNORMALIZATION CONSTANT= ,E13.5)
WRITE(6,1100) (XNA1'-1E,XAXIS(I) ,F1(I) ,I=l,IMAX)
1100 FOR)I1AT(lH0,25X,3HF1(,A6,3H = ,F6.2,4H) ~ ,E13.5)
c
c
CALL PLOT (F1,IMAX,PRINT,XAXIS)
C NORtvlALI ZE G1
CALL BIG (G1,BIGGST)
WRITE (6,1090) BIGGST
WRITE(6,1110)(YNAME,YAXIS(J),G1(J),J=1,JMAX)
1110 FORMAT(1H0,25X,3HG1(,A6,3H = ,F6.2,4H) = ,E13.5)
c
cc
CALL PLOT
(Gl,J~1AX,PRINT,YAXIS)
I
i
i
l
I
Ill
NORMALIZE H1
CALL BIG (H1,BIGGST)
I
----------···-----·----------·--------------·---·------------------_]
23
...
-~·~------....,·-···~-- --..._.....-·~·--,.._---..--..-~~----~--~---~-·----~,-·
.
... -~..... ,;,... ______ ,~------~---·-->·-~---------..:..-~-----~---··--·-···.. ---'-~:......- ...,
WRITE (6,1090) BIGGST
WRITE(6,1120) (ZNA~1E,ZAXIS(K) ,Hl(K) ,K~l,Kl\!AX)
1120 FORMAT(lH),2SX,3IIIIHl(,A6,3Il = .,F6.2,4H) == ,E13.S)
c
CALL
c
c
c
c
'
PLOT (Hl,KMAX,PRINT,ZAXIS)
REMAIN==Z
CALL REMANE(REMAIN,FLSCAL)
CONTINUE
PRODUCT PORTION OF PROGRAM
2500
C
c
NPROD=l
I 2998 CONTINUE
c
c
I
I
NPROD=NPROD+1
NUMITR=O
INITIALIZE F,G,H
DO 2997 MM=l,lS
G4(MM)==O.O
H4(MM)=o0.0
2997 CONTINUE
DO 6 0 0 0 IviM~ 1 , JMAX
G4(MM)=1.
6000 CONTINUE
DO 6001 MM=l,K.MAX
H4 (1'-IiVI)
= 1.
6oo1 CONTINUE
1
jC
l
c
DO 2999 NN=l,lS
F4(NN)=O.
F4A(NN)=O.
2999 CONTINUE
3000 CONTINUE
c
c
c
C
c
NUMITR=NUMITR+1
METHOD=l
CALL PRODKT (R, IMAX, Ji\1AX, Ki\IAX, G4, H4, F4, METHOD)
F CANNOT BE FIXED HERE SINCE DETERMINES CONVERGENCE
GO TO (701,712,713,714,715,716,701) ,NPROD
712
CONTINUE
C FIX FZ HERE
GO TO 701
713
CONTINUE
C FIX F3 HERE
GO TO 701
-...---·-~------------------------~-----------------------~----·-·
24
r-·-··--------·-·----·-------~---------·····--·------····--------~--~.--;-··-·
714
CONTINUE
C FIX F4 HERE
GO TO 701
715
CONTINUE
C FIX FS HERE
GO TO 701
716
CONTINUE
C FIX F6 HERE
701
CONTINUE
METHOD=Z
CALL PRODKT (R, Ji'vl.r'\X, H1AX, Kf,lAX, F4, H4, G4, JI.IETHOD) .
!C
C
C
C
jC
C
c
c
I
C
C
C
C
GO TO (800,81~813,814,815,816,800), NPIWD
812 CONTINUE
FIX G2 HERE
CALL RELAIR(G4, G4A, RELERR,J~1AX)
GO TO 800
813 CONTINUE
FIX G3 HERE
CALL RELAIR(G4,G4A,RELERR,JMAX)
GO TO 8CO
814 CONTINUE
FIX G4 HERE
CALL RELAIR(G4,G4A,RELERR,JMAX)
GO TO 800
815 CONTINUE
FIX CS HERE
CALL RELi\.I R( G4, G4A, RELERR, JJv1AX)
GO TO 800
816 CONTINUE
FIX G6 HERE
800 CONTINUE
METHOD=3
CALL PRODKT (R,Klv1AX,H1AX,JMAX,F4,G4,H4,i\IETHOD)
GO TO (900,912,913,914,915,916,900), NPROD
912 CONTINUE
FIX HZ HERE
GO TO 900
913 CONTINUE
FIX H3 HERE
GO TO 900
914 CONTINUE
FIX H4 HERE
GO TO 900
915 CONTINUE
FIX HS HERE
GO TO 900
916 CONTINUE
l FI~~~LII~~~AI~-(l~-~A,~E ~!<:C-
LE
.
~
KMAX) _________________________ _]
25
900 CONTINUE
c
C
c
c
c
IF (NUNITR
IF (NUMITR
IF (RELERR
CALCULATE NEW
.LT. 10) GO TO 3000
.GT. 200) GO TO 9000
.GT. 0.0001) GO TO 3000
REMAINDER
DO 3050 I=1,IMAX
DO 3050 J=l,JMAX
DO 3050 K=1,KMAX
M=K
R(I,J,K)=R(I,J,K)-(F4(I)*G4(J)*H4(M))
3050 CONTINUE
~
CALL BIG (F4,BIGGST)
BIGF=BIGGST
WRITE (6,3120) NUMITR,SCALE
3120 FORMAT (1H1,6HAFTER ,13,28H ITERATIONS, SCALE FACTOR
= ,F8.3)
WRITE (6,3150) NPROD,BIGGST
3150 FO.RJ\1AT (1HO,lOX,2HKF,Il,3H
,E13.5)"
CALL BIG (G4,BIGGST)
BIGG=BIGGST
WRITE (6,3160) NPROD,BIGGST
3160 FORMAT (1H0,10X,2HKG,Il,3H = ,E13.5)
c
c
c
c
c
c
CALL BIG (H4,BIGGST)
BIGH=BIGGST
WRITE (6,3170) NPROD,BIGGST
31 7 0 FQ.Rl\1A T ( 1 Ho , 1 0X, 2HKH , I 1 , 3H = , E1 3 . 5 )
BEEG=BIGF*BIGG*BIGH
. WRITE (6,3180) NPROD,BEEG
3180 FORMAT (1H0,15X,4HKFGH,Il,3H = ,E13.5)
WRITE ( 6, 3 2 0 0) (NPROD, XNAJv1E, XAXI S (I) , F4 (I) , I== 1 , IMAX)
3200 FORMAT(lH0,2SX,lHF,I1,1H(,A6,3H=,F6.2,4H) = _,El3.5)
CALL PLOT(F4,IMAX,PR1NT,XAXIS)
WRITE(6_,3210) (NPROD,YNAtviE,YAXIS(J) ,G4(J) ,J=l,JMAX)
3210 FOID<lAT(lH0,25X,lHG,Il,lH(,A6,3H =,F6.2,4H) = ,E13.5)
CALL PLOT ( G4, JtvlAX, PRINT, YAXI S)
WRITE(6,3220)(NPROD,ZNAME,AZXIS(K) ,H4(K) ,K=1,KMAX)
3220 FORMAT(lH0,25X,lHH,Il,lH(,A6,3H = ,F6.2,4H) = ,El3.5):
c
c
C PRINT
c
RE~lAINDER ~\TRIX
--------
;
______j
~·
--rc
---·-·--,---·~~----~---~·-----------------
·- ·- - ----· . . . . . . . -·- · ·--··- - ·-· . ----------.. --·- - - - -·-· - - - -.·• . . .,
RE1-.1AI N == NPROD + 1
CALL REMANE(REMAIN)FLSCAL)
!
-
IF(NPROD .LT. 6) GO TO 2998
CONTINUE
CONTINUE
CONTINUE
23
FORJ'.L\T(l5F6. 2)
24
WRITE(6,102)
FORMAT(1H,28HTHE NUJ'.!BER OF DATA CARDS IVAS,13)
1 0-2
STOP
END
SUBROUTINE CONST
COM1·10N/ ZI LCH/R ( 15, 15, 15) , IMAX, Jt-U\X, KMAX, AMAX, Br.'lAX,
C\'.LI\X, SCALE
REAL MEAN
MEAN==O.
DO 1 1 "'1, IMJ\X
DO 1 J=l,JMAX
DO 1 K=l,KMAX
MEAN=MEAN+R(I,J,K)
1 CONTINUE
MEAN= MEAN/ ( AMAX *BMAX ~; CHA X)
WRITE (6,2)MEAN
,E13.5)
2 FORMAT,(lH0,15X,13HMEAN VALUE
DO 3 I=l, IMAX
DO 3 J==l,JMAX
DO 3 K= 1, Klv'tAX
R(I,J,K)=R(I,J,K)-MEAN
3 CONTINUE
RETURN
END
SUBROUTINE REMANE (REMAIN FLSCAL)
COMiv!ON/ ZILCH/ R( 15, 15, 15) , IMAX, JMAX, Klv!AX, AMAX, BMAX,
CM,I\X, SCALE
COf.1MON/LAWIFE/XAXIS(15),YAXIS(l5),ZAXIS(15) ,XNAME,
YNAME,ZNAME,PRIN
*T(l30)
COMJ\10N/TITLE/TT1, TT2, TT3
DO 5 K=l,KMAX
WRITE (6, 2) REMAIN, ZNMilE, ZAXIS (K), SCALE, TTl, TT2, TT3
2 FORMAT (1Hl,24HTHE PRESENT REMAINDER R(,I1,8H), WITH
,A6,3H = ,FlO
*.4,17H, SCALE FACTOR= ,F8.3,10X,3A6)
WRITE (6,25) YNAME,(YAXIS(J) ,J=1,JMAX)
25 FORMAT(1HO,A6,2H == ,11X,15(1X,F6.2))
WRITE(6,26)
26 FORMAT (1HO)
DO 4 I==1, IMAX
WRITE (6,3) XNAI'vlE,XAXIS(I), (R(I ,J ,K) ,J=1,JMAX)
3 F0 RMA T ( 1 H- , A6 , 3H = , F6 . 2 , 4 X , 1 5 ( 1 X , F6 . 2 ))
I gooo
,z 5
j
lI
I
----4
--~ONT ~~~--------·---------------~------·---···-~----------··-----------J
27
5 CONTINUE
,, cc AVERAGE ABSOLUTE AND RMS ERROR COMPUTATION
ABSMAX=O.
AVABER=O.
AVGRMS=O.
DO 51 I=1, IMAX
DO 51 J=J,JMAX
DO 51 K=l, Kl\'!AX
ABSMAX=J\tviAX1 (ABSlviAX, ABS (R (I, J, K)))
AVABER=AVABER+ABS(R(I,J,K))
51 AVGR)IIS=AVGRivlS+R(l ,~T ,K) -;;*2
AVGRMS=SQRT(i\VGRMS/ (AMAX~'BMAX*C!v1AX-1.))
AVABER=AVABER/ (AMAX*BMAX*C:tvLi\X)
PCTRMS=(AVGRMS/FLSCAL)*100.
PCTABS=(AVABER/FLSCAL)*lOO.
PCTMAX=(ABSMAX/FLSCAL)*100.
WRITE (6, 52) REMAIN, FLSCAL ,AVABER, PCTABS ,AVGR!I1S,
PCTRMS
52 FORMAT(lH1,25X,20HFOR THE REMAINDER R(,I1,33H) BASED
ON A FULL SCA
*LE VALUE OF ,F6.2,///,10X,25HAVERAGE ABSOLUTE ERROR
=,F7.3,15X,33
*HPERCENT AVERAGE ABSOLUTE ERROR= ,F7.3,//,10X,20HAV
ERAGE RMS ERROR
*R = ,F7.3,20X,28HPERCENT AVERAGE RMS ERROR= ,F7.3)
WRITE (6,53) ABSMAX,PCTMAX·
53 FOIUv1AT ( 1HO, 9X, 2 SHMA.XU'IUM ABSOLUTE ERROR = , F7. 3, lSX, .
24HPERCENT MA
*XIMUM ERROR= ,F7.3)
WRITE (6,6)
6 FORMAT (1H1)
RETURN
END
SUBROUTINE RELAIR (ARRAY1,ARRAY2,RELERR,LMAX)
DIMENSION ARRAY1(15), ARRAY2(1S)
RELERR=O.
DO 1 I=1, LMAX
RELERR=RELERR+ABS ( (ARRAY1 (I)- ARRAY 2 (I))/ ARRAY1 (I))
ARRAY2(I)=ARRAY1(I)
1 CONTINUE
WRITE (6,2) RELERR
,E13.5)
2 FORMAT (lH, 27HRELATIVE ITERATION ERROR
RETURN
END
SUBROUTINE BIG (ARRAY,BIGGST)
DIMENSION ARRAY(15)
BIGGST=O.
DO 1 I= 1,15
j'l\
L_~_i_~~-·~_:A~--~-~_i_1_~_r_GJ_j_~;_~-I~G_s_T~---------------------J
''
1 CONTINUE
DO 2 I=1.15
ARRAY (I) ~ARRAY (I) IB I GGST
2 CONTINUE
RETURN
END
SUBROUTINE PRODKT (R,IIMAX,JJ.t->iAX,KKr.!AX,ARRAYJ,ARRAYK,.
ANSWER,MET!-IOD
.
*)
1
2
11
13
21
25
30
80
DIMENSION ARRAYJ(JJ.tvlAX) ,ARRAYK(KK.tv!AX) ,ANSWER(IH1AX),
R(15,15,15)
REAL NUMRTR
DO 2 II=1,IIMAX
NUMRTR=O.
DENOM=O.
DO 1 JJ=l,JJMAX
DO 1 KK=1,KKMAX
IF(METHOD.EQ.1) NUMRTR=NUMRTR+R(II,JJ,KK)*ARRAYJ(JJ)*
ARRAYK(KK)
1 F (METHOD. EQ. 2) NUl'.fRTR,.-cNUMRTR+ R(JJ, I I, KK) *ARRAYcJ ( JJ) * •
ARRAYK(KK)
IF(METHOD.EZ.:5) NUHRTR=NUMRTR+R(.JJ,KK,II)*ARRAYJ(JJ)*
ARRAYK(KK)
DENOM=DENOM+ (ARRAY J (JJ) * *2) -;, (ARRAYK (KK) **2)
CONTINUE
ANSWER(II)=NUMRTRIDENOM
CONTINUE
RETURN
END
SUBROUTINE PLOT (ARRAYP,IIMAX,PRINT,AXIS)
DIMENSION ARRAYP(IIMAx-) ,PRINT(l21) ,AXIS(IIMAX)
DATA BLANK,DOT,DATAPT I 1H ,1H=,lHXI
WRITE (6,11)
FORlviAT (lHl)
DO 20 L=l,61
DO 13 N=1,121
PRINT(N)=BLANK
CONTINUE
PRINT(1)=DOT
IF (L .NE. 31) GO TO 25
DO 21 N=1,121
PRINT(N)=DOT
CONTINUE
CONTINUE
DO 30 II=1,IIMAX
IY=60-L+l
IVALUE=30.*ARRAYP(II)+30.5
IX= ((AXIS (I I)-AXIS (1)) I (AXIS (I IMAX) -AXIS ( 1) *12 0.) +1. 5
IF (IVALUE . EQ. IY) PRINT (IX) =DATAPT
CONTINUE
WRITE (6,80) PRINT
FORMAT (1H ,100A1,21A1)
-----,·-------------·---~-----·~-~-·-------·------------
29
..·-·-----
·'-!
·--~--·"'-
. ..
-~-
~----..-..~---
......
..
-~---......__----~~-~--------·---~~-~----~--~·---~---- -~------<·~----- --------~,-~
-·
··-----< -·-·--·--··~~··- .. "·:·
7.0 CONTINUE
WRITE (6,90)
90 FORMAT (lHl)
RETURN
END
SUBROUTINE AVERG(DJI.!AX,UviAX,E4)
DH!ENSION E4(15)
SUM=O.
DO 7 0 0 0 J ,= 1 ~ LMAX
SUM= SUI'-!+ Et~ ( .J)
7000 CONTINUE .
AV=:SlJM/DMAX
DO 7 0 0 1 .J = 1 , UlAX
E4(.J)=AV
7001 CONTINUE
RETURN
END
SUBROUTINE RMSSUB
CO:tviMON/ Z I LCII/R ( 15, 15, 15) , I:MAX, .JMAX, KMAX, AMAX, BMAX,
C:MAX,SCALE
·-··-·1
1
j
j
IU1=1
2
IU2=11
TU3=1
IU4=9
IU5=1.
IU6=1
SUM=O
DO 5041 I=lU1,IU2
DO 5041 .J=IU3,IU4
DO 5041 K=IUS,IU6
SUM=SUM+R(I,J,K)*R(I,J,K)
DENOM=(IU2-IU1+1)*(IU4-IU3 +1)*(IU6-IU5+1)
SUM=SUM/(DENOM-1.)
SUivi=SQRT (SUM
WRITE(6,2)SUM
F0R[\1AT(1H,22HAVERMS FOR SUB-RANGE .=,F10.5)
RETURN
END
I
.-·--.·-------------------- ~---------·--··----J
30
f:\~·;·-··~--~ox -~~~---------------·-··--~·---·····-~---····-----·--···-··-----------···-··J
MAINPROGRAM
DIMENSION Fl23(21,9,8),F124(21,9,1) ,F134(21,8,1),
F234(9,8,1)
DIME NS I 0 N F ( 21 , 9 , 8 , 1) , FF ( 21 , 9 , 8 , 1) , F1 ( 21) , F 2 ( 9) , F 3 ( 8),
F4 (1), F12 (21
1,9) ,F13(21,8) ,Fl4(21,1) ,F23(9,8) ,F24(9,1) ,F34(8,1)
INTEGER W,X,Y,Z
DIMENSION IFORM(9),IFOR1(5),IFOR2(10)
DIMENSION IHDR(4),IFOR3(10)
DATA VARI,VAR2,VAR3,VAR4,VAR12,VAR13,VAR14,VAR23,
VAR24,VAR34IlO*O .
. 101
c
DATA VAR, VR12 3, VR12 4 , VR13 4 , VR2 3 4 I 5 :~ 0. 0 I
THIS PROGRAM APPROXHLt\TES A FOUR VARIABLE
FUNCTION USING FUNCTIONS OF ONE, TWO,·
AND THREE VARIABLES
lc
iC
·c
c
c
c
THE ARRAYS I FORJv!, I.FORl, I FOR2, AND I FOR3
CONTAIN VARIABLE FORJvJAT STATEMENTS
IFORM(l)=5H(1X,I
IFORM(2)=5H2,2X,
IFORM(3)=5H12,2X
I F 01Uv1 ( 4 ) = 5 H , I 2 , 2
IFORM(S)=SHX, 5X,
IFORM(6)=SH
I F 0 PJ-1 ( 7 ) = 5 H
0(
IFORM(8)=SHF9.4,
IFORM(9)=5H1X))
IFORl(l) = 5HlX,$F
IFOR1(2) = 5Hl$4X,
IFOR1(3)
SH O(F9
IFOR1(4) = SH.4,1X
IFORI(S)
SH)
IFOR2(1) = 5H1X,$F
IFOR2 (2)
5H12 W
IFOR2(3)
SH
X=
IFOR2(4)
SHl- 0
5H $,1
IFOR2(5)
IFOR2(6)
5H, 0(7
IFOR2(7) = 5HX,I2,
IFOR2(8)
5H9X, 0
IFOR2(9) = 5H(F9.4
IFOR2(10) = SH,lX))
IHDR(1)=5HIII,l
IHDR(2)=5HX,$Fl
IHDR(3)=5H23 ...
I HDR ( 4 ) = 5H. $ , II
IFOR3(l)=SHSX,$W
IFOR3(2)~5H=$,12
I
.....----------------------···-··-----··--·----..J
31
,-~----:------~-;~~--~--:~--"----~-------~-----------·-------------··--~·~:--··· : ............·----------·-·······1
r For,_, c3) : : .) d , $
1
c
3001
105
3000
11
c
111
1
I
c
c
222
2
c
c
x
I FO H. 3 ( 4 ) = 5I-I"" $ , I 2
-.
IF 0 R3 ( 5) ~ 5 H , $ Y
. .. ·
I~OH.~(6)=5H""1- 0
IFQRj(7}=5H $,SX
IFOR3(8)=SH, O(F
IFOR3(9)=SH9.4,1
IFOR3(10)=SHX)
READ IN THE DATA ARRAY
READ(5,3001) W,X,Y,Z
FORlllAT(4l3)
DO 1 0 5 I 3 = 1 , 8
DO lOS IZ=-=1,9
DO 105 11=1,21
READ(5,3000) F(Il,I2,I3,1)
FORMAT(l9X,Fl5.8)
I .
-_
-·
-
·
-
-
I
1
I
l
I
.·I
I
~-
.
I
I
1
~-
-I
~-
I
!·
= z
CALCULATE THE MEAN VALUE OF THE DATA
IFORM(7) = IFORM(7)+Z*64
WRITE (6,2000)
WRITE (6,1001)
WRITE (6,1008) LL
SUM= 0.0
DO 1 I==l,W
DO 1 J""1,X
DO 1 K==l,Y
DO 111 L=l, Z
SUM=SUM+F(I,J,K,L)
CONTINUE
WRITE (6,IFORM) I,J,K, (F(I,J,K,L),L=l,LL)
CONTINUE
WRITE (6,2000)
COUNT
W*X*Y:!: Z
VMEAN = SUM/COUNT
NORMALIZE THE DATA SO THAT THE MEAN IS
ZERO
WRITE (6,1002) VMEAN
WRITE (6,1008) LL
DO 2 I=l, W
DO 2 J:o:l,X
DO 2 K=l,Y
DO 222 L=l,Z
F(I,J,K,L)=F(I,J,K,L)-VMEAN
VAR = VAR+F(I,J,K,L)**2
CONTINUE
WRITE (6,IFOR1vl) I,J,K,(F(I,J,K,L},-L=l,LL)
CONTINUE
WRITE (6,2000)
CALCULATE THE SINGLE VARIABLE FUNCTIONS
AND EACH ONE'S VARIANCE
WRITE (6,1003)
Dl = X*Y*Z
l-----------
-·
......
-~
I
I
I
DO 1 0 . I= 1-~ W---~-··-····-····--·-·----·-·------·..---~---~·-··-·--·--·-·-··-~---···~-·~··1
CALL FUN2(Vl,I,I,l.X,l,Y,l,Z}
Fl(I) = Vl/Dl
10 VARl = VARl+Fl(T1**2
VARI ~ X*Y*Z*VARi
IFOR1(3) = IFOR1(3)+W+2**18
II = W
WRITE (6' IFOR1) (F1 (I)' 1=1' II)
D2 = W*Y*Z
DO 20 I=l ' X
CALL FUN2(V2,1,W,I,I;l,Y,1,Z)
F2(I) = V2/D2
20 VAR2 = VAR2+FZ,{l) **2
VAR2 == W*Y~:z*vAR2
IFOR1(2) = SH2$4X,
IFOR1(3) = IFOR1(3)+(X-W)*2**18
II = X
WRITE (6,IFOR1) (F2(I),I=l,II)
D3 = W*X*Z
DO 30 I=l,Y
CALL FUK2(V3,l,W,l,X,I,I,l,Z)
F3(I)
=
I
I
I
!
I.
l
I
l
1
·
\ .
I
I
\
I
I
V3/D3
30 VAR3 = VAR3+F3(I)**2
VAR3 = W*X*Z ;t:VAR3
IFOR1(2) = SH3$4X,
IFOR1(3) = IFOR1(3)+(Y-X)*2**1~
II = Y
WRITE (6,IFOR1) (F3(I),I=l,II)
D4 = W*X*Y
DO 40 I=l,Z
CALL FUN2(V4,1,W,l,X,1,Y,I,I)
F4-(I) = V4/D4
40 VAR4 = VAR4+F4 (I) **2
VAR4 = W*X*Y*VAR4
IFOR1(2) = 5H4$4X,
IFOR1(3J = IFOR(3)+(Z-Y)*2**18
II= Z
WRITE (6,IFOR1) (F4(I),I=1,II)
. WRITE (.6, 2000)
CALCULATE THE RESIDUAL OF THE FIRST
APPROXI:tvlATI ON
IFORM(8) = SHE8.6,
WRITE(6,1009)
WRITE (6,1008) LL
DO SO I=1,W
DO 50 J=l,X
DO 50 K=1,Y
DO 49 L=1,Z
F(I,J,K,L) = F(I,J,K,L)-(F1(I)+F2(J)+f3(K)+F4(L))
49 CONTINUE
WRITE (6,IFORM) I,J,K, (F(I,J,K,L) ,L=1,LL)
50 CONTINUE
.
..:..
c
c
-
..---..- ....
r··~·--·-·-:---···----·-··-··--------
·----~-------------------····-·---
..-----------...-.......... . ........._________ _
WRITE (6,2000)
CALCULATE THE TWO VARIABLE FUNCTIONS
EACH ONE'S VARIANCE
WRITE (6,1010)
IFOR2(4} = IFOR2(4)+X*64
IFOR2(6) = IFOR2(6)+W*2**12
IFOR2(8) = IFOR2(8)+X
Dl2 = Y*Z
DO 60 I=l,W
DO 59 J=l,X
CALL FUN2(Vl2,I,I,J,J,l,Y,l,Z)
F12(I,J) = V12/Dl2
VAR12 :.:.: VAR12+F12 (I ,J) i-*2
59 CONTINUE
J,J == X
WRITE (6,IFOR2) I,(Fl2(I,J) ,J=l,JJ)
60 CONTINUE
VAR12 ~ Y*Z*VAR12
IFOR2(2)
5Hl3 W
IFOR2(3) = SH
Y=
IFOR2(4) = IFOR2(4)+(Y-X)*64
IFOR2(8) = IFOR2(8)+(Y-X)
Dl3 = X*Z
DO 70 I=l,W
DO 69-J=l,Y
CALL FUN2(V13,I,I,l,X,J,J,l,Z)
F13(I,J) ~ Vl3,D13
VAR13 = VAR13+F13(I,J)**2
69 CONTINUE
JJ
A~D
= y
WRITE (6,IFOR2) I, (F13(I,J) ,J=l,JJ)
·70 CONTINUE
VAR13 = X*Z*VAR13
IFOR2(2) = SH14 W
IFOR2(3) = SH
Z=
IFOR2(4) = IFOR2(4)+(Z-Y)*64
IFOR2(8) = IFOR2(8)+(Z-Y)
D14 = X*Y
DO 80 I=l, W
DO 79 J=l,Z
CALL FUN2(V14,I,I,l,X,l,Y,J,J)
Fl4(I,J) = V14/Dl4
VAR14 = VAR14+Fl4 (I ,J) **2
79 CONTINUE
JJ
= z
WRITE (6,IFOR2) I,(F14(I,J),J=l,JJ)
80 CONTINUE
VAR14 = Z*Y*VAR14
IFOR2(2)
SH23 X
IFOR2(3) - SH
Y==
IFOR2(4)
IFOR2(4)+(Y-Z)*64
1
___ IFOR2(6) = IFOR2(6)+(~~W)*2.:*12 _____-___________ ___!
34
·.
,,
89
90
99
100
109
110
C
C
IFOR2(8) = IFOR2(8)+(Y-Z)
D23 = w:~:z
DO 90 I=l,X
DO 89 J=.l, Y
CALL FUN2(V23, l,iV,I,I,J,J,l,Z)
F23(I,J) = V23/D23
VAR23 = VAR23+F23(I,J)**2
CONTINUE
JJ = y
WRITE (6,IFOR2) I,(F23(I,J),J=l,JJ)
CONTINUE
'
VAR23 = W*Z*VAR23
IFOR2(2)
5H24 X
IFOR2(3) = SH
Z=
IFOR2(4) = IFOR2(4)+(Z-Y)*64
IFOR2(8) = IFOR2(8)+(Z-Y)
D24 == w•~y
DO 100 I=1,X
DO 99 J=1,Z
CALL FUN2(V24,1,W,I,I,1,Y,J,J).
F24(IMJ) = V24/D24
VAR2 4 = VAR2 4 + F 24 (I , J) * * 2
CONTINUE
JJ = z
WRITE (6,IFOR2) I,(F24(I,J),J=1,JJ)
CONTINUE
VAR24 = W*Y*VAR24
IFOR2(2) = SH34 Y
IFOR2(6) = IFOR2(6)+(Y-X)*2**12
D34 = W*X
DO 110 I=1,Y
DO 109 J=1,Z
CALL FUN2(V34,l,W,1,X,I,I,J,J)
F34(I,U) = V34/D34
VAR34 = VAR34+F34 (I ,J) *•t:2
CONTINUE
JJ = z
WRITE (6,IFOR2) I,(F34(I,J),J=1,JJ)
CONTINUE
VAR34 = W*X*VAR34
WRITE (6,2000)
CALCULATE THE RESIDUAL OF THE SECOND
APPROXIMATION
WRITE (6,1017)
WRITE (6,1008) LL
DO 120 I=1,W
DO 120 J=1,X
DO 120 K=l,Y
DO 119 L=1,Z
F(I,J,K,L)=F(I,J,K,L)-(F12(I,J)+F13(I,K)+Fl4(I,L)+F23l·
(J,K)+F24(J,L
.
--------~--------·_ ....J
35
1)+F34(K.L))
119 CONTINUE
WRITE (6,IFORM) I,J,K,(F(I,J,K,L) ,L=l,LL)
120 CONTINUE
I
WRITE (6,2000)
lc
CALCULATE TilE THREE VARIABLE FUNCTIONS
C
AND THEIR VARIANCES
WRITE (6,1100)
IFOR3(6)=IFOR3(6)+Y
IFOR3(8)=IFOR3(8)+Y*4096
JJ=Y
D123=Z
WRITE(6,4123)
DO 21 0 I = 1 , \V
DO 210 J"'l,X
DO 200 K=l,Y
CALL FUN2(Vl23,I,l,J,J,K,K,l,Z)
F123(I,J,K)=Vl23/Dl23
200 VR123=VR123+Fl23(I,J,K)*Fl23(I,J,K)
210 WRITE (6,IFOR3) I,J,(Fl23(I,J,K),K=l,JJ)
VR123=Dl23*VR123
IHDR (3)=5H24 ...
IFOR3(5)=5H,$ Z
IFOR3(6)=IFOR3(6)+(Z-Y)
IFOR3(8)=IFOR3(8)+(Z-Y)*4096
JJ=--~z
220
230
240
250
D124=Y
WRITE(6,4124)
DO 230 I=l,W
DO 230 J=l,X
DO 220 K=l,Z
CALL FUN2(V124,I,I,J,J,l,Y,K,K)
F124(I,J,K)=Vl24/D124
VR124=VR124+Fl24(I,J,K)*Fl24(I,J,K)
WRITE (6,IFOR3) I,J,(F124(I,J,K),K=l,JJ)
VR124=Dl24*VR124
JHDR(3)=5H34 ...
IFOR3(3)=5H,$ Y
WRITE (6,2000)
Dl34=X
WRITE(6,4134)
DO 250 I=l,W
DO 250 J=l,Y
DO 240 K=l,Z
CALL FUN2(Vl34,I,I,l,X,J,J,K,K)
F134(I,J,K)=Vl34/Dl34
VR134=VR134+Fl34(I,J,K)*F134(I,J,K)
WRITE(6,IFOR3) I,J,(F13(I,J,K) ,K=l,JJ
VR134=Dl34*VR134
IHDR(2)=5HX,$F2
IFOR3(1)=5H5X,$X
D234=W
I
I
I
1
!
36
WRITE(6,4234)
DO 2 7 0 I'"' 1 , X
DO 270 J=l,Y
DO 260 K=l,Z
CALL FUN2(V234,l,W,I,I,J,J,K,K)
F234(I,J,K)=V234/D234
VR234=VR234+F234(I,J,K)*F234(I,J,K)
WRITE (6,IFOR3) I,J,(F234(I,J,K),K=l,JJ)
VR234=D234*VR234
Cl\LCULATE THE RESIDUAL OF THE THIRD
APPROXHv1ATION AND ITS VARIANCE
WRITE (6,2000)
IVRITE (6, 1030Y
WRITE (6,1008) LL
VARPP==O.O
DO 290 I=l,W
DO 290 J:=:l,X
DO 290 K=l,Y
DO 280 L=l,Z
F(I,J,K,L)=F(l,J,K,L)-(Fl23(I,J,K)+Fl24(I,J,L)+Fl34
(I,K,L)TF234(J,
.
lK,L))
280 VARRP=VARRP+F(I,J,K,L)*F(I,J,K,L)
290 WRITE (6,IFORM) I,J,K,(F(I,J,K,L),L=l,LL)
WRITE (6,2000)
_
C
PRINT THE VARIANCE TABLE
VT1=VARl+VAR2+VAR3+VAR4
VT2=VAR12+VAR13+VAR14+VAR23+VAR24+VAR34
V13=VR123+VR124+VR134+VR234
VT==VTl+VT2+VT3
TVAR=VT+ VARH.P
V~l==lOO.*VARl/VAR
VP2=100.*VAR2/VAR
VP3=100.*VAR3/VAR
VP4=100.*VAR4/VAR
VP12=100.*VAR12/VAR
VP13~100.*VAR13/VAR
VP14=100.*VAR14/VAR
VP23=100.*VAR23/VAR
VP24=1 0 0. ~r:vAR24/VAR
VP34=100.*VAR34/VAR
VP123=100.*VR123/VAR
VP124~100.*VR124/VAR
L
VP134=100.*VR134/VAR
VP234=100.*VR234/VAR
VPTl=lOO.*VTl/VAR
VPT2=100.*VT2/VAR
VPT3=100.*VT3/VAR
VPTT==lOO.*VT/VAR
VPFR=lOO.*VARRP/VAR
VPCK=lOO.*TVAR/VAR
WRITE (6,1200) VAR
·---·------------------~------·---------------·--'
37
WRITE (6,1210) VARl,VPl,VAR2,VP~,VAR3,VAR4,VP4,VTl,
VPTl
WRITE (6,1220) VAR12,VP12,VAR13,VPI3,VAR14,VPI4,
VAR23,VP23,VAR24~V
1001
11002
1003
1008
1009
1010
1017
1100
1030
1200
1210
1220
1230
. I
1240
2000
4123
4124
4134
4234
1P24,VAR34,VP34,VT2,VPT2
WRITE (6,1230) VR123,VP123,VR124,VP124,VR134,VP134,
VR234,VP234,VT3
1,VPT3
WRITE (6,1240) VT,VPTT,VARRP,VPFR,TVAR,VPCK
FORMAT (IX, $THE GIVEN PUNCTION FF (W, X, Y, Z) $, /)
FOR~~T(lX,$THE NORMALIZED FUNCTION F(W,X,Y,X)=FF(W,X,.
Y,Z)-MEANiWH
.
lERE THE MEAN=$1F8.SI)
FORMAT(1X,$THE CALCULATED ONE VARIABLE FUNCTIONS $1)
F01{MAT (IX, $W
X Y
Z=I THRU $>I 2
FORMAT(I,1X,$THE RESIDUAL R $,1)
FOI&1AT ( lX, $THE CALCULATED TWO VARIABLE FUNCTIONS
$ '/)
FORMAT(/ ,lX, $THE RESIDUAL R $,I)
FORMAT(IX,$THE CALCULATED THREE VARIABLE FUNCTIONS
$,11)
FORMAT(/,IX,$THE RESIDUAL R3 $,/)
FORMAT (J_HI, 2 OX, $VARIANCE TABLE$, I I I, 7X, $VARIANCE$,
2IX,$PERCENT OF
ITOTAL$,III,SX,$V(F) = $,E14.7.14X,$100.0000$,1)
FORMAT(4X,$V(Fl) = $,F14.7,14X,F8.4,I,4X,$V(F2)
$,Fl4.7,14X,F8.4
1,1,4X,$V(F3) = $,El4.7,I4X,F8.4,1,3X,$ V(F4) =
$,EI4.7,14X,F8.4,I,
2IX,$SUBTOTAL = $,E14.7,I4X,F8.4,/)
FORMAT(3X,$V(F12) = $,F14.7,14X,F8.4,I,3X,$V(Fl3)
$ ,-E14. 7, 14X, F8
1.4,1,3X,$V(F14) =$,E15.7,14X,F8.4,I,3X,$V(F23) =
$,E15.7,14X,F8.4,1
2,3X,$V(F24) = $,El4.7,14X,F8.4,I,3X,$V(F34) = $,El4.7
,14X,F8.4,I,l
3X,$SUBTOTAL = $,El4.7,14X,F8.4,1)
FORMAT(2X,$V(Fl23)
$,El4.7,14X,F8.4,I,2X,$V(Fl24)
$ , E I4 . 7, 14 X,
1F8.4,/,2X,$V(Fl34) = $,El4.7,14X,F8.4,I,2X,$V(F234) =
$,E14.7,14X,
2F8.4,I,1X,$SUBTOTAL = $,El4.7,I4XiF8.4,1)
FOR1v!AT(4X,$TOTAL = $,EI4.7,14X,F8 .. 4,I,SX,$V(R)
$,El4.7,I4X,F8.4,
lii,3X,$VTOTAL =$,El4.7,I4X,F8.4)
FORMAT (lHI)
FORI\iAT(/ ,1X,$Fl23 ... $,/)
FORMAT(III,lX,$Fl24 .. . $,1)
FOR~iAT(III,lX,$FI34 ... $,1)
FORMAT(/ I/, lX, $F234 ... $,I)
STOP
END
-~--·----------·---·
l
--------------·----------------------J
38
r~·--·---·----·-------·-·-.
I
I
.
·--··---------------·---------,----------c-·-·--···----·-· ·- -- -..
SUBROUTINE FUNZ (VALUE,Il,I2,Jl,J2,Kl,K2,Ll,L2)
DIMENSION F(21,9,8,l)
VALUE == 0
DO 10 I=I.l,I2
DO 10 J==Jl,J2
DO 10 K=K1,K2
DO 10 L=Ll,L2
10 VALUE
RETURN
END
VALUE+F(I,J,K,L)
i
-·
---·--------------~-----------------------·--·---------...1
39
A. 3 MINtvlAX
MAINPROGRAM MINiY!AX
DIMENSION F1(5,25),N(S) ,MX(S),F2(10,25,25)
EQUIVALENCE (N(1) ,NJ) ,) _, (N(2) ,NZ), (N(3) ,N3),
(N(4) ,N4), (N(5) ,NS)
COMMON
F(S~9,11,11,1)
c
c PROGRAM MINMAX OBTAINS A .SUM OF FUNCTIONS APPROXHfATION
c TO A FUNCTION OF UP TO FIVE VARIABLES WHICH MINIMIZES
c THE MAXIMUM ERROR
I~
c
c
'c
c
c
~c
~~c
SUBROUTINE RDN(Nf IS USER SUPPLIED AND IS USED TO
GENERATE OR READ THE DATA IN THE ARRAY F
THE USER MUST ALSO SUPPLY APPROPRIATE STATEMENT OF THE
FORM
COMMON F(1,2,3,4,5,)
WHERE THE ACTUAL DIMENSIONS USED ARE ADEQUATE FOR THE
INPUT F
THIS COMMON STATEMENT MUST APPEAR IN PROGRAM MINMAX AS
WELL AS IN SUBROUTINES RDN AND_FAP
c INPUT VARIABLE DESCRIPTION, ONE (1) CARD, FORMAT(715)
c (N(I),I=1,5) = N1,N2,N3,N4,N5 ARE THE NUMBER OF ENTRIES
c IN THE FIRST, SECOND, ETC VARIABLES FOR THE INPUT
c
lc
c
c
c
c
c
c
c
c
FUNCTION F.
NPR = 0 IS NOru.fAL
NPR = I WILL GIVE A PRINTOUT OF THE FITTING FUNCTIONS
AND ~HE ERROR AT EACH ITERATION
NVF = 1 GIVES AN APPROXIMATION BY A SUM OF ONE VARIABLE
FUNCTIONS
NVF = 2 GIVES AN APPROXIMATION BY A SUM OF TWO VARIABLE
FUNCTIONS
100 100 READ(5,1)N,NPR,NVF
IF(NLLE.O) STOP
CALL RDN(N)
DO 150 IS=l,N5
DO 150 I4=1,N4
DO 150 I3=1,N3
DO 150 I2=1,N2
1 5 0 WR I TE ( 6 , 3 )I 2 , I 3 , 14 , I 5 , ( F ( I 1 , I 2 , I 3 , I 4 , I 5 ) , I 1 =1 , N1 )
no 160 r=1,5
IF(N(I).EQ.1)GO TO 170
160 NV=I
170 NVM=NV-I
ITMAX:=:30
IT=l
EPS=l. E-:- 7
--------~~---~--------~-·-----------,------------·---------·-
------------
-------- -----------------------
'
f
'ooo 0
0
"'" ---·· "''''
-
•
0------
. . . . . - - - • • ••
•••
· · · · - - • • • •••••• - - - - - · · ·
...... - - · - - - - - ·
DO 200 I=1,S
DO 190 J=1,25
I
190 F1(I,J)=O.O
M(I)=l
\ 200
MX(I)=N(I)
DO 210 1=1,10
DO 210 J=1,25
DO 210 K=1,25
FZ(I,J,K)=O.
210
DX=O.O
225
IF(NVF.GT.l)GO TO 310
1;
1
c
C
c
250
300
c
C
c
310
340
350
360
I
l
370
390
THE CALCULATI_ON Of' ONE VARIABLE APPROXH!ATIONS
DO . 3 0 0 I= 1 , NV
NP=N(I)
DO 250 J"=1,NF
M(I)=-=J
MX (I) "',J
CALL FAP(FV,M,MX)
DX=-"AMAYI (ABS (FV) ,DX)
Fl(I,J)=FV+F1(I,J)
M(I)=1
MX(I)=NP
CONTINUE
GO TO 390
THE CALCULATION OF TWO VARIABLE APPROXIMATIONS
MF=O
DO 370 I=1,NVM
rx=I + 1
NPI=N(I)
DO 360 K==IX,NV
MF=MF+l
NPK=N (K)
DO 3SO JI=l,NPI
M(I)=JI
MX (I) =JI
DO 340,JK= 1,NPK
.t-·1 (K) =JK
MX(K)=JK
CALL FAP(FP,M,MX)
DX=Mv!AXI (ABS(FV) ,DX)
F2(MF,JI,JK)=F2(MF,JI,JK)+FV
CONTINUE
M(K)=l
MX(K)=NPK
CONTINUE
M(I)=l
MX(I)=NPI
CONTINUE
CONTINUE
·
-----~----~--·----~-----------~------------------~--~----------~-·--------~-----------------··--"
- --
.
41
r---------- ·-yr:cni·.--L T
-~-'E j)"sTco~ro· -~f-6-6~--------
---------_________ . __.,__________________ -------------·· ·-· · - - - - - · · · -------1
I
IT=IT+l
WRITE(6,391) IT,DX
391 FORMAT($IT=$,13,$DX=$,El6.7)
IF(NPR.EQ.))GO TO 412
400 WRITE(6,7)DX,IT
IF(NVF.GT.L)GO TO 412
WRITE (6,6)
DO 410 I=I,NV
NP=N(I)
.
410 WRITE (6, 8) I, (Fl (I ,J) ,J=1 ,NP)
GO TO 418
412 MF=O
WRITE(6,6)
DO 415 I=l,NVM
NPI==N(I)
IX=l+1
DO 415 K=IX,NV
WRITE(6,12)K
MF=MF+1
NPK'-"N (K)
DO 415 JK:::1,NPK
415 WRITE (6,9)I,K,JK,(F2(MF,IK JK),IK=NPI)
418 CONTINUE
AVGRMS=O
AM=O.
DO 419 I5=l,N5
DO 419 I4=1,N4
DO 419 I3=1,N3
DO 419 I2=l,N2
DO 419 I1=1,N1
AVGRMS=AVGRMS+ F (I 1, I 2, I 3, I 4, I 5) * F (I 1, 12, I 3, I 4, I 5)
419 AM=AMAXI (ABS (F(I1, I2, I3, I4, IS) ,AM))
AVGRMS=SGRT(AVGRMS/(N1*N2*N3*N4*N5))
WRITE (6,11)AM,AVGRMS
DO 420 I5=l,N5
DO 420 I4=1,N4
DO 420 I3=l,N3
DO 420 I2=1,N2
4 2 0 WRITE {6 , 3) I 2 , I 3 , I 4 , I 5 , ( F (I 1 , I 2 , 13 , 14 , I 5) , I 1 =1 , N1)
IF(DX.LT.EPS.OR.IT.GT.ITMAX) GO TO 600
GO TO 225
500 WRITE(6,4)IT
I
GO TO 400
-~
1 FORMAT (16 I 5)
3 FORMAT(4I4,1P10E11.3/(16X,10E11.3))
4 FORMAT(4SHOCONVERGENCE FAILURE, NUi'-1BER OF ITERATIONS
IS,IS)
5 FORMAT(64HlTHE INPUT FUNCTIONS, FIRST INDEPENDENT
i
VARIATION ACROSS
1THE PAGE/16HO I2 13 I4 IS)
6 FORMAT(9HOFUNCTION)
3
I
I
----------------------------·-----------·--····· _______________
_]
42
·.
----~----·-•- -~-·-·
---·-" ·• •• ,, --·----·------.c.............
--•-'•--·~-·~-----·---···---
_.__..,, ..... _ .. _,........... ·-- ......................... -···-.-·---- ....................... ,
FORMAT (7 SHOTHE APPROXIMATING FUNCTIONS FOLLOW. LAST i.
DF AND NUMBER
I
lOF ITERATIONS WIRE /PE12.S,Il0//)
!
8 FORrvlAT(~HOF,Il,7X,1PlOE11.~/(lOX,~O~l.~·2))
9 F 0 RMA T ( ~ HF ' 2 11 ' 16 ' 1 p 1 0 E 11 . J I (l 0 X ) I 0 c 11. j ) )
i
11 FORMAT(43H1TI-IE ERROR ARRAY FOLLOWS, MAXH!Ul'-1 ERROR
.
IS, 1PE12,4,13H1
1RMS ERROR IS, LPE12.4/16HO 12, 13, I4, IS)
12 FORMAT ( / 8 X• 1! I I , 11)
600 STOP
END
-S-UBROUTINE FAP (FV ,M,MX)
DIMENSION M(1J~MX(1)
7
l
c
COJvll>10N F (5, 9,11,11, 1)
C
C
C
C
FAP FINDS THE MAX AND MIN VALUES OF F WITH INDEX 11
VARYING
FROM M(l) TO MX(1), I2 VARYING BETWEEN M(2) AND
MX(2), ETC.
C
FV IS THE AVERAGE VALUE OF THE MAXIMUM AND i\HNIMUivl
VALUES, AND SUBTRACTED FROM THAT SET OF FUNCTION
VALUES
IB1
M(l)
IB2 = M(Z)
IB3 = :M(3)
c
C
C
1B4
=
M(4)
IB5 = M(S)
Nl
MX(1)
N2 - MX(2)
N3
MX (3)
N4 = MX(4)
NS
MX(S)
A= l.ElO
Z = l.E10
DO 100 I1=IBl,N1
DO 100 I2~IB2,N2
DO 100 I3=IB3,N3
DO 100 I4=IB4,N4
DO 100 IS=IBS,N5
A = AMAX 1 ( F (I 1 , I 2 , I 3 , I 4 , I 5) , A)
100 Z = AMIN1(F(I1,12,I3,I4,IS),Z)
FV = (A+Z)/2.
DO 120 I1=IB1,N1
DO 120 I2=IB2,N2
DO 120 I3=IB3,N3
DO 120 I4=IB4,N4
DO 120 IS=IBS,NS
120 F(I1,I2,I3,I4,IS) = F(I1,I2,I3,I4,IS) - FV
RETURN
END
I
I
- I
I
l
1
I
I
I
I
I
I
SUBROUTINE RDN(N)
DIMENSION N(1)
COMMON F(5,9,ll,ll,l)
Nl
N(1)
N2.
N3
N4
NS
=
=
=
=
N(2)
N(3)
N(4)
N(S)
DO 110 T5=1,NS
DO 110 I4~l,N1
DO 110 I3==1,N3
DO 110 I2<l,N2
DO 110 T1=1,N1
110 READ(5,30) F(Il,I2,I3,I4,I5)
30 FORMAT(19X,F15.8)
RETURN
END
i
I
I
I
I
I
I
I'
I
I
J
I
I
I
-.
PART II
SPREAD SPECTRUM
COMMUN~CATION
TECHNIQUES
r
I
I
I
I
I
I
---------------------·
-~-~---·~-~-....... ----------~·------~-~--·---~------~---·~~-.,_
44
45
.~ )
TABLE OF CONTENTS
PAGE
1. 0 INTRODUCTION . . . . . . . .
46
2.0 SPREAD SPECTRUM TECHNIQUES
46
3. 0 TWO RESULTS FRQlll COJviMUNTCATIONS THEORY
47
4.0 PROCESSING GAIN
48
!s.O
.....
FREQUENCY HOPPING SYSTEMS
49
REFERENCES .
52
BIBLIOGRAPHY
53
46
.
r··----·-----·-··--------··-------···------··------------~------- --~-------------------~-----·--···-··--·-
I.o
INTRODUCTION
_
·
..-------
-
Spread spectrum communication techniques are currently:
!being studied as methods of communicating information over '
!channels which are subjected to man-made interference.
Spreading the frequency spectrum of the communications s1g-
the vulnerability of these techniques to i11terception and
/jamming.
This paper will introduce the readeT to some
basic characteristics of spread spectrum techniques.
2.0
SPREAD SPECTRUM TECHNIQUES
the frequency content is confined to a relatively narrow
reglon around some center frequency.
To interfere with
!
i
such a signal requires a narrowband energy source.
ing the spectrum of· the signal, however, would make the
interference task more difficult.
the energy over a wider bandwidth.
The jammer must spread
Thus, the energy den-
sity in the frequency domain is decreased.
In this way,
the jamming effect of a powerful noise source would be
reduced.
I
Spread- :
For covert conrnunications applications of spread
I'
47
r~::,:::;: :~:~::::: :::~~,::~:::,::~;::~::-~~:::-·~~: ::::s- ~ ~ -1
!then much more difficult.
.
,
I
Implementation of spread spectrum systems has been
difficult and costly in the past.
!face
acoustic wave devices
~hich
The development of surperform correlation or
!matched filter ftmcb'lons can greatly reduce the complexity
I
lof system hardware.
Bell et a1.
1
and Kino and Matthews
2
discuss the present and potential uses of surface acoustic
wave devices in communications systems.
3.0
TWO RESULTS FROM COMMUNICATIONS THEORY
The uncertainty relation as derived by Helstrom
3
shows that there is a coupling betwe~n the bandwidth of a
!signal and its time duration.
'1/2
~
where
D.
w·L\t;;:
.c..w is the root-mean-squared (RMS) frequency
of the s-ignal, and
signal.
The relation is:
4
t
is the RMS time duration of the
Hence, in general, a spreading of the frequency
spectrum of a signal will require a decrease in the time
duration of the signal.
Another result of interest was derived by Shannon
The capacity, C, of a communications channel
bits per second is given by:
C=Wlog
2
meas~red
4
in
(S/N), where W is
the bandwidth of the signal, S is the average power of
the
rec~ived
signal, and N is the average power of the
channel noise.
the rate of
The channel capacity is an upper limit on
1
transm~ t~:~ inform~ti-on ~-In_c~e-as~:~_th~-~nu-J
·.
f: ~ ::~:,:: :~: ~:~: ~:r::-::~:; t:::,::,:-:::~a-~ :~-::~a: -::~;-~ ;- d
~on
4.0
-:
Stant
ratio.
signal-to-noise
.
PROCESSING GAIN
Processing gain is defined as the ratio of the spread
!bandwidth of a signal to the bandwidth of the modulated
[information signal, i.e. PG=n
ss
/Bd t. .
a a
The processing
gain is a useful measure of the interference reducing
effect of spread spectrum techniques on communications
channels.
.i
To illustrate, consider an
inform~tion
signal, m(t), of average powerS.
modulated
Assume the signal is
multiplied by a wideband signal a(t) to produce a spread
!spectrum signal,
Js·m(t) a(t), and that the receiver
<
I
I
includes a correlator for spre~d spectrum demodulation.
Then, the output of the correlator is ls~·~(t) •a(t)
n(t)·a(t)
+
, where n(t) is uncorrelated interference of
average power N.
Cahn
5
shows that the resulting inter-
ference term, n(t)·a(t), will have average power
=
N·Bdata/Bss
N/PG.· Hence, the spread spectrum signal
inhibits the interference by a factor of 1/PG . . As a
''
result, the receiver can operate at the signal-to-noise
ratio S/N
(1/PG)
=
(S/N)data' where (S/N)data is that
needed by a conventional receiver for the same message
I
modulation.
I
--------·---------·-----------------~------·---------···-··---J
·--..---·-·
5.0
FREQUENCY HOPPING SYSTEMS
Frequency hopping is a spread
~pectrwn
technique
currently finding application in satellite and covert
tactical communications.
The transmitter of a frequency
hopping system is capable of transmitting a signal which
may have one of many carrier frequencies.
The information
I
!modulation is such that each frequency is used approxlbately as much as every other frequency.
The bandwidth,
over time, of a frequency hopping system will appear somewhat as illustrated in Figure I.
A block diagram of a frequency hopping transmitter
and receiver are given in Figure II .. In this system the
1
!carrier frequency is modulated to carry binary information.
This signal is mixed with a higher frequency carrier for
!transmission.
A pseudorandom code sequence is used to
jswitch the RF carrier frequency.
These sequences are
jproduced by a pseudorandom code generator, usually a shift
I
lregister.
A synchronised code generator is at the
receiver to demodulate the frequency hopped signal.
If
the information modulation is frequency shift keying, the
processing gain of the system is the maximum number of RF
frequencies capable of being transmitted.
There are many variations of the basic frequency
hopping technique.
For example, Hunsinger et al. have
developed a spread spectrum communications system using a
combination of frequency hopping and pseudonoise phase
-------------··--·--·----·-·-·---
·-·-··-·-·-·-----------···--.1
so
modulation
6
•
The unclassified literature also includes a study by
Cohen 7 of the statistical properties of a frequency
hopping transmission intercepted by a narrowband receiver,
and a description by Lebow et a1.
8
of a frequency hopping
!system developed for satellite communications.
!
j
i
I .
l
... _,. . . .,.____
..:.....__ _ _ _
~-·--·
I
lI
Q·-·--·-------------·---------·---~---··-----·---~--------~""'
51
r---~---·----
------------------.----------------·-____________________. _____ . _ _ _ _. _:_ _ _ _ - - - --.. . . - - - - - - - - . _ srf.)
_
1-----
g --------1
BANDWIDTH, B, OF FREQUENCY HOPPING SYSTEM
FIGURE I
'.
'
CARRIER
\vI DE DAN D
t1JXER
FREQUENCY
SYtvTHESflER
FRE~
VL!YC )/
'(NTH ESI iE R
--R.Ewv ~R.
TRANSM JTTER":l_
CODE
&ENERI\~J
DF/100U:ATO~
_
CODE
-
r
6-ENt.(<ATOR .
I
I
FREQUENCY HOPPING SYSTEM
FIGURE II
'--
Il
·---------------------------------------------------------------
52
REFERENCES
1.
Bell, D., Holmes, J., and Ridings, R.
"Application of
Acoustic Surface-Wave Technology to Spread Spectrum
Communications."
IEEE Transactions on Sonics and
Ultrasonics, April 1973r pp. 181-189.
2.
Kino 1 G., and Matthe1-.rs, H.· "Signal Processing in
Acoustic Surface Wave Devices," IEEE Spectrum,
August 1971, pp. 22-35.
3.
Helstrom, C.
Statistical Theory 6f Signal Detection.
London Pergammon Press, 1960, pp; 18-22.
4.
Shannon, C. and Weaver, W.
The Mathematical TheoTy
of Communication.
University of Illinois Press,
Urbana, Ill., 1963, pp. 100-101.
5.
Cahn, C.
"Spread SpectTum Applications and State-ofthe-Art Equipments," p. 5-3, in Spread Spectrum
Communications.
Advisory Group for Aerospace Research
and Development, July 1973.
6.
Hunsinger, B., Burke, A., Bush, H., Richards, W., and
Entzminger, J.
"Coherent FH/PN Synthesizer Using
SuTface Wave Techniques," IEEE Transactions on Sonics
and Ultrasonics, OctobeT 1974, pp. 289-293.
7.
Cohen, S.
"Interference Effects of Pseudo-Random
Frequency-Hopping Signals," IEEE Transactions on
Aerospace and Electronic Systems, March 1971, pp.
279-287.
8.
Lebow, I., Jordan, K., and Drouilhet, P.
"Satellite
Communications to Mobile Platforms," Proceedings of
the IEEE, February 1971, pp. 139-156.
----------'--
·------·---------------------- ---_________j
5 :s
r---------------- -- ---------------------------~-------------_-----------------··---------------------- ------ -----------·---·----·-
BIBLIOGRAPHY
1
I!Advisory
1
1
l
i
Group for Aerospace Research and Development.
Spread Spectrum Communications._ Paris, France.
July, 1973, (Defense Documentat1on Center Accession_
Number AD-766 914).
UNCLASSIFIED.
jHelstrom, C.
Statistic~! Theo~y of Signal Detection.
London Pergammon Press, 1960.
1
I
!Naval Electronics Laboratory Center.
Proceedings of the
1973 Symposium on Spread SpectrUJn Communications.
M. L. Schiff, Coordinator.
San Diego, California,
March, 1973.
(Volume I, Defense Documentation,
Center Accession Number AD 915 852.
SECRET.
!
Volume II Defense Documentation Center Accession
I
Number AD S28 360L.
UNCLASSIFIED).
I1Shannon,
1
!
C. E. and Weaver, W. The Mathematical Theory of
Communication.
University of Illinois Press,
(Urbana, Ill), 1963.
Ii
I
I
l
----~----------:__
.
______________________________________________________________________
I
I
------------·
© Copyright 2026 Paperzz