A matrix technique to calculate signals recorded using the microwave amplitude-modulation technique is described. The calculations are carried out for spin packets, on and off resonance, to take into account inhomogeneous broadening. Both, the transverse component of magnetization representing the continuous-wave signal in a resonator, such as a cross-looped resonator, as well as the signal (electromotive force) induced in a pickup coil oriented parallel to the external magnetic field, ate calculated for an arbitrary value of the coefficient of modulation. This is accomplished by solving the relevant Bloch equations in the rotating frame for the case when the amplitude of the microwave field is modulated by a sinusoidal wave, using Fourier expansions of the longitudinal and transverse components of the magnetization in Bloch equations. This results in a series of coupled equations in M~,(n) (a = y, z), the magnetic moments of various orders, leading to a penta-diagonal matrix of infinite dimension. These equations are then truncated and solved by a fast matrix technique to calculate M,(n), required to calculate the modulation signals as functions of the amplitudemodulation frequency .(2. It is outlined how to exploit the expressions for the modulation signals to estimate the spin-lattice relaxation times T~ and spin-spin relaxation times T z accurately by the leastsquares procedure, fitting simultaneously all signals obtained for spin packets, on and off resonance, at various modulation frequencies. Illustrative examples are provided.