A new, analytical description of the physical processes determining the spectral response of an energy dispersive X-ray spectrometer with a silicon detector (Si(Li) or silicon drift detector (SDD)) is presented. The model considers the detector statistical noise, the electronic noise, the incomplete charge collection (ICC) that gives rise to the peak tailing, the escape effect, the fluorescence of the front contact or the dead layer and hot photoelectrons that cause the shelf. Only five free parameters are necessary to model the response function: the electronic noise, three parameters describing the shape of the charge collection efficiency beneath the front contact and the thickness of the detector front layer. Once the five parameters are adjusted to have agreement between a measured and a calculated response function, the response function can be calculated for any other photon energy in the range from 0.1 keV to 30 keV.The algorithm is implemented in IDL and MATLAB and is available also as MATLAB stand-alone program. It enables the determination of the optimum parameter set by fitting a calculated response function to a measured one for monochromatic radiation. A (m,n)-type matrix can be calculated whereby m represents the number of channels for the response function and n the number of photon energies in the selected range. The matrix can be used to convolute a calculated spectrum for comparison with a measured one.The calculated response functions are in agreement with the pulse height distributions measured with monochromatic synchrotron radiation in the energy range from 0.1 keV to 10 keV for three spectrometers with detector crystals different in construction. It is shown that the improved description of the detector response enables the detection of minor components of characteristic lines in fluorescence spectra, which have been attributed earlier to the detector.