fig1 is a graph which illustrates the operation of a servomechanism , and which also illustrates the problem solved by the present invention . curve 1 is the command signal , i . e . the waveform representing the desired motion of the controlled object . the position scale is in inches ; the error scale is in millionths of an inch . the time scale is in milliseconds . curve 2 is the measured position signal , i . e . the waveform indicative of the actual position of the object . the command signal must lead the position signal , due to the inherent delay in obtaining a physical response to an electronic command . fig . 1 depicts a theoretical case in which the amplitudes of the command and measured position signals are equal , so that there is no need to correct amplitude errors . in the prior art , it has been known to shift the command signal in time , to compensate for the lag described above . fig1 shows the error signal , i . e . the difference between the command and position signals , for various amounts of such time shifts . the parameter τ represents the amount by which the time of the command signal is advanced . curves 3 , 4 , 5 , and 6 represent the error signal for four different values of τ . although the error signals in fig1 summarize the effects of introducing time advance , it is noted that curve 1 represents the command signal before any time advance has been introduced . in the case of fig1 it is assumed that the amplitudes of the command and position signals are equal . in this special case , there is an optimum value of τ which makes the magnitude of the error zero . from fig1 one can see that the magnitude of the tracking error due to a non - optimal value of the time advance τ is greatest at those points where the command signal is changing most rapidly . the magnitude of the error is least when the command signal is at an extremum . from analysis of fig1 one can devise a method of adjusting τ to minimize the magnitude of the error . suppose , for example , that the slope of the command signal is positive . then the magnitude , i . e . the absolute value , of the error is reduced by adjusting τ in the direction indicated by the inverted sign of the error . that is , where the error is positive , the error is reduced by decreasing τ . where the error is negative , the magnitude of the error is reduced by increasing τ . where the slope of the command signal is negative , the same kind of analysis applies . in this case , the magnitude of the error is reduced by adjusting τ in the direction indicated by the uninverted sign of the error . where the error is positive , τ is increased , and where the where the error is negative , τ is decreased . in many applications , the command signal is stored , in digital form , in a table . it is therefore comparatively easy to vary the amount of time advance , by moving to a later value from the table . in other applications , where the command signal is not stored in a table , some other form of time advance would be needed . fig2 is similar to fig1 except that fig2 also shows the effect of an amplitude error , i . e . a difference between the amplitudes of the command and position signals . curve 10 represents the command signal , and curve 11 represents the measured position . curves 12 , 13 , 14 , and 15 are the error signals for τ = 0 . 27 ms , τ = 0 . 28 ms , τ = 0 . 29 , and τ = 0 . 30 ms , respectively . the same kind of analysis , discussed with respect to fig1 applies to fig2 . that is , the parameter τ can be adjusted in the same way to reduce the position error . in general , when the servomechanism has an uncorrected amplitude error , there is no value of τ which will insure perfect tracking , even in theory . fig2 illustrates this principle by showing the error signal for several values of τ . fig3 shows the effects of adjusting the amplitude of the command signal to compensate for errors in the system . curve 20 is the command signal , before adjustment , and curve 21 is the position signal . the amplitude correction is made by multiplying the command signal by ( 1 + k ). the error signals are plotted for four values of k . in particular , error curves 22 , 23 , 24 , and 25 correspond to k = 0 . 005 , 0 . 010 , 0 . 015 , and 0 . 020 , respectively . fig3 shows that the error due to amplitude errors is greatest where the waveform is at an extremum , and is least where the waveform is changing most rapidly . in fig3 the value of the time advance τ is optimal ; that is , in fig3 the only errors are due to errors in amplitude . in adjusting the amplitude of the command signal , it is also necessary to compensate for changes in the average level of that signal . if the average level is nonzero , multiplication by the factor ( 1 + k ) will introduce a new error into the command signal . it is therefore necessary to subtract an average value before multiplying by ( 1 + k ), and then to add back the average value . from fig3 one can also devise a method of adjusting the parameter k , similar to that described for τ , above . for example , where the command signal is at a minimum , the error is reduced by adjusting k in the same direction indicated by the sign of the error signal . thus , when the error signal is positive , the error is reduced by increasing k . when the error signal is negative , the magnitude of the error is reduced by decreasing k . where the command signal is at a maximum , the error is reduced by adjusting k in the opposite direction indicated by the sign of the error signal . in this case , when the error signal is positive , the error is reduced by decreasing k , and when the error signal is negative , the magnitude of the error is reduced by increasing k . fig4 is a block diagram of one embodiment of the invention which implements the method discussed above , for minimizing the magnitude of the tracking error of a servomechanism . in fig4 servo unit 30 includes adder 32 and amplifier 34 . the servo unit drives actuator 40 , which may generate either linear or rotational motion . it is understood that the servo unit can be any conventional servo system . the servomechanism itself , i . e . the components within block 30 , and the actuator , do not form part of the invention . the command signal enters the circuit at line 36 . time adjustment circuit 38 introduces a predetermined amount of time advance into the command signal . comparator 42 generates an error signal , i . e . a signal representing the algebraic difference between the command signal and the actual position of the object being controlled . this error signal is sampled by sampling circuit 44 . circuit 44 is preferably a &# 34 ; sample and hold &# 34 ; device , which records the value of the input signal at a given instant and holds that value for a longer period . timing circuit 46 determines when the sampling circuit reads the output of comparator 42 , and therefore determines what parts of the command signal waveform are sampled . circuit 48 adjusts the polarity of the output of the sampling circuit . the output of the sampling circuit is either inverted or uninverted . the signal is then integrated in integrator 50 . the output of the integrator is added to a predetermined value τ o in adder 52 , and the result is connected to time adjustment circuit 38 . the value of the output of adder 52 therefore determines the amount of time advance caused by circuit 38 . the timing circuit 46 controls the time at which sampling circuit 44 operates , and also determines whether circuit 48 inverts its input or allows that input to pass through unaltered . since the parameter being adjusted is the time advance τ , and since fig1 and 2 show that a correction to τ is most effective where the command signal is changing most rapidly , the timing circuit can be programmed to enable the sampling circuit only at those points in the command signal waveform . in cases where the command signal is known in advance , the points at which the signal is most rapidly changing are also known in advance . in an alternative embodiment , the timing circuit includes a circuit for sensing when the first derivative of the command signal has just passed through a maximum , and for enabling the sampling circuit immediately after detecting the latter condition . in still another alternative embodiment , the timing circuit includes a circuit which senses when the position command equals its average value , and enables the sampling circuit immediately thereafter . the polarity control circuit 48 assures that the polarity of the sampled error signal , which is to be integrated , will change τ in a direction such that the magnitude of the error signal is minimized . as is apparent from fig1 and 2 , the polarity of the output of circuit 44 needs to be inverted when the slope of the command signal is positive , but should not be inverted when the slope of the command signal is negative . for example , in fig2 where the slope of the command signal is positive , and where the error is positive , one can reduce the magnitude of the error by reducing τ . where the error is negative , one can reduce the magnitude of the error by increasing τ . the same kind of analysis can be applied for the points where the slope of the command signal is negative . polarity control circuit 48 is shown to receive input from timing circuit 46 , because the polarity adjustment depends on the instantaneous slope of the command signal . and , as explained above , the value of the slope is obtained by timing circuit 46 , either by direct measurement , or by interpretation of previously stored information about the waveform of the command signal . the output of circuit 48 therefore comprises a series of corrections to the value of τ . integrator 50 adds and smooths these corrections , and the output of the integrator is combined with a predetermined starting value τ o to yield a corrected value of τ . the latter value controls time adjustment circuit 38 , to determine the amount of time advance . the value of τ o may be stored in non - volatile memory , symbolically indicated by block 54 , and may be based on a reasonable estimate of the time advance needed in most servo systems . alternatively , the value of τ o may be the last value of τ computed and stored in a previous &# 34 ; run &# 34 ; of the system . the latter alternative is especially useful if one is doing several runs in sequence . normally , the last calculated value of τ will most accurately reflect the most recent changes in temperature , friction , etc . the storage means 54 may therefore include means for storing the most recently calculated value of τ , for later use as τ o . another scheme for setting τ o is to use a different set of values for different runs , depending on the operating conditions for each run . the value of τ o may vary depending on the load on the actuator at a particular moment . block 54 can therefore represent a memory device which supplies different starting values of τ o at different times . fig5 is a block diagram showing an embodiment of the invention wherein the system adjusts there different parameters of the command signal . these parameters are the time advance , the amplitude , and the average level , or offset , of the waveform . for the sake of simplicity , the components corresponding to block 30 , in fig4 are omitted in fig5 . the position command signal originates in block 60 , the signal being generated either by reference to a stored table , by calculation , or by other means . as indicated symbolically , &# 34 ; position &# 34 ; can mean either linear or angular position . the command signal is adjusted in the three blocks 62 , 64 , and 66 . block 62 is a time adjustment circuit , similar to circuit 38 of fig4 and provides the amount of time advance designated by τ . block 64 simply multiplies the command signal by ( 1 + k ), where k is the amplitude correction , discussed above . adder 66 combines the command signal with offset correction x o , to be discussed below . as shown in fig5 the corrections for time advance , amplitude , and offset are determined independently , and in parallel . the command signal is compared with the measured position signal ( coming from block 68 ), in comparator 70 , and the output of the comparator , i . e . the error signal , is connected to the inputs of sampling circuits 72 , 74 , and 76 . the sampling circuits are all similar to circuit 44 of fig4 and are connected to timing circuits 78 , 80 , and 82 . the timing circuits are similar to circuit 46 of fig4 ; they enable the sampling circuits at selected times . the output of sampling circuit 72 is connected to polarity control circuit 84 , which is similar to circuit 48 of fig4 . the output of circuit 84 is integrated in block 88 , after having been multiplied by a predetermined gain factor in block 86 . the gain factor is an adjustment which determines the speed with which the adjusted parameters converge on their proper values . the larger the gain , the more rapid the convergence . however , the rapid convergence is associated with more severe swings in the error value , and with more noise . the gain factor should thus be made adjustable , but the adjustment is not critical , and the gain factor would not need to be adjusted frequently . the integrated signal is added to the starting value τ o of the time advance , in adder 90 , which is similar to element 52 of fig4 . the result is fed to circuit 62 to determine the amount of time advance . the signal which is sampled in circuit 74 also passes through a polarity control circuit , designated as block 92 . the polarity control circuit and sampling circuits are connected to timing circuit 80 . as in the case of the time advance , the resulting signal is fed to a gain adjusting circuit ( block 94 ), an integrator ( block 96 ), and an adder ( block 98 ). after 98 combines the integrated signal with a stored starting value k o for the amplitude correction . the starting value may be stored in the same manner described for the starting value of the time advance , discussed with reference to fig4 . for the sake of simplicity , no storage means , similar to block 54 of fig4 are shown in fig5 but it is understood that such circuitry can be used if needed . the treatment of the offset correction is similar , but not identical , to that of the other parameters . sampling circuit 76 is controlled by timing circuit 82 , and the output is multiplied by a desired gain factor , in block 100 , integrated in block 102 , and added to a starting value in adder 104 . the starting value of the offset may be stored in the same way described with respect to the starting values of the other parameters . there is no polarity control circuit in the adjustment of the offset . the reason is that the polarity of the offset correction is always the same . whenever there is a nonzero error signal , which is not due to misadjustment of other parameters such as time advance or amplitude , the error is likely to be due to an offset error . the system therefore compensates for this error by adjusting the offset of the command signal . more particularly , the system corrects the offset by adding the inverted error signal to the command signal . the offset error may be sampled at any point on the waveform , and the sign of the error , at each point , is always inverted . fig6 is a diagram which summarizes the sampling and polarity control of the the present invention . sine wave 120 represents a command signal . arrows 122 indicate the points on the command signal at which the latter signal is sampled for correction of time advance . arrows 124 and 126 indicate the sampling points for the amplitude and offset corrections , respectively . the plus and minus signs indicate whether the polarity of the sampled signal needs to be inverted or kept constant . thus , for example , in the case of the amplitude correction , the sampled signal taken when the command signal is at a maximum is inverted , and the signal taken at the minimum is not inverted . the command signal need not , of course , be sinusoidal , but it must be time - varying for the time advance and amplitude parameters to be meaningful . the timing circuits can also be programmed to take into account special requirements of a particular application . for example , it may be desirable to disable the sampling circuit when the load on the actuator is changing abruptly . thus , if there are segments where the lathe is not cutting , adjustment for average error would be suspended entirely , and adjustment for amplitude errors would be suspended over the non - cutting segments . in many applications , it is known in advance where the abrupt changes in the command signal will occur . it may also be necessary to disable the sampling circuits when the waveform of the command signal approaches a constant value . as stated above , the concepts of time advance and amplitude have no meaning when the waveform is not time - varying . the timing circuits can therefore be programmed to suspend the adjustment of these parameters while the command signal is relatively constant , and to resume adjustment when significant variations resume . the invention can be implemented in either analog or digital form . in the digital implementation , the adjusted position command , which is a digital signal , is fed to a digital - to - analog converter , the output of which is amplified and used to drive the actuator position control loop . the measured position of the object is detected by either an analog or digital encoder , of conventional design , which supplies a measurement of position for processing by the position control loop , and for calculation of position error for the adaptive functions . the digital implementation is often advantageous in that it is possible to store a large number of different command signals in tabular form , in a nonvolatile memory . in those cases where the command signal is much simpler , the analog implementation may be preferable because it eliminates the need for conversion between analog and digital formats . fig7 is a graph which illustrates the performance of the present invention in moving an actuator to a desired final position . curve a shows the error signal , described above , as a function of time . the scale of the error is shown at the left , in microinches , and the time is shown in milliseconds . curve b represents the time advance parameter τ , which was intentionally set at an incorrect initial value . the curve shows that the value of τ converges quite rapidly to the correct value . curve c represents the amplitude correction parameter k , described above . it , too , converges rapidly to the correct value . curve d represents the offset correction . the values of the time advance , amplitude , and offset parameters are all shown on the left - hand portion of the graph . while the invention has been described with respect to two particular embodiments , it is understood that other variations are possible . for example , it may be desirable to adjust other parameters of the command signal , or to adjust other combinations of such parameters . the particular means by which the sampling , integration , etc . of the signals are done may be varied . as mentioned above , the adjustment of parameters may be interrupted when the load on the moving object is changing very rapidly , or when the command signal becomes non time varying . these and other modifications should be deemed within the spirit and scope of the following claims .