I'd like to start with a note that if I knew a good answer to this question, I would be spending my time earning money on selling guitar emulation virtual instruments, rather than sharing the information for free.
Note also, that as far as I'm aware, presently the best guitar virtual instruments are based on sampling, rather than modeling. This may give a hint about the difficulty of the task.
The first part of the sound is attack. It's percussive, i.e. continuous spectrum and broad band, depending on whether the string is plucked by a finger, finger nail, or plectrum, its shape, texture, and also angle and time duration of the contact with the string. Guitar body resonance (at least with classical and acoustic instruments) may contribute significantly to the attack sound.
Plucking the string starts with displacing it from the equilibrium into a triangular shape, with the tip rounded (due to finite size of the finger, nail or plectrum, and the string rigidity). Fourier transform of this shapes gives the initial ratio of amplitudes of the harmonic components.
As the string vibrates, the amplitude of various frequencies decays in various ways, as the energy is transferred to the instrument body, the air, or dissipated internally in the string, which depending on the string parameters.
Various characteristics of guitar body and construction affect how quickly energy various harmonic components is dissipated, for all types of guitars, both classical/acoustic, and for solid body electric as well.
There are (at least!) two effects causing inharmonicity:
- frequency of harmonic components is slightly increased due to string rigidity
- When a string vibrates with large amplitude, it's effective tension increases, resulting in pitch changing as a function of the decaying amplitude (time)
The inharmonicities depend on string material (Young's modulus), string gauge, length and tension. They also may result in transferring energy between harmonic components.
The string transfers energy to the guitar body via the bridge. For nylon strings this is primarily via transverse vibrations, while for steel strings both transverse and longitudinal vibrations contribute to a similar degree.
Finally, how the actual sound is produced? In classical/acoustic instruments the sound is primarily emitted by the top plate, with some additional contributions of the sound hole (resonance of the air cavity), and the back, altogether captured by a microphone, placed at some location. Then you have instruments with piezo pickups, and finally electric guitars with electromagnetic pickups. There are also some more exotic systems like optical transducers or pickups capturing vibrations of the body. Any of these systems, and its parameters affect the final sound significantly.
Last but not least are various additional sounds, characteristic for guitar. What comes to my mind is the noise when sliding the finger along the string (in particular the wound strings) and fret buzz. Also, guitarists use multiple articulation techniques which extend the spectrum of available sounds.
"electric guitar" fourier analysis
which mostly gives instructional articles and videos on how to use Fourier analysis on electric guitars. There is one technical investigation article upfront: johndcook.com/blog/2016/05/10/electric-guitar-distortion. On the basis of the FA diagrams there and elsewhere, their frequency-power spectrum appears to be pretty messy, which may explain why they are so hard to model.