Measured beam profiles and central-axis depth-dose data for 6- and 25-MV photon beams are used to generate a dose matrix which represents the full beam. A corresponding dose matrix is also calculated using the modified CBEAM model. The calculational model uses the usual set of three parameters to define the intensity at beam edges and the parameter that accounts for collimator transmission. An additional set of three parameters is used for the primary profile factor, expressed as a function of distance from the central axis. An optimization program has been adapted to automatically adjust these parameters to minimize the chi 2 between the measured and calculated data. The average values of the parameters for small (6 X 6 cm2), medium (10 X 10 cm2), and large (20 X 20 cm2) field sizes are found to represent the beam adequately for all field sizes. The calculated and the measured doses at any point agree to within 2% for any field size in the range 4 X 4 to 40 X 40 cm2.