I think you're taking the right approach for the sample & hold and
quantization in the transient simulation.
You're almost right with the sampling in the frequency domain -- you're
not taking aliasing into account, but as long as your output filter
doesn't have appreciable gain above Nyquist then you're all set there.
Traditionally, the way to account for the quantization in the frequency
domain is to model it as noise injection. This makes sense if you think
about it right: the output of a quantization step is your desired signal
plus an error, so you just call that error "noise" and do some analysis.
You would like to be able to model it as being random, which would make
it white in the sampled-time domain, and roughly white but perfectly band-
limited to the sampling rate in the continuous-time domain. In reality,
this only happens if you have enough other noise in the circuit to keep
the quantization agitated -- the more pessimistic approach is to model
the quantization noise as being a sine wave that is 1.09 a quantization
step peak to peak (to account for the fact that it's a square wave), and
at the worst possible frequency. This accounts for the fact that -- if
all else is quiet -- your circuit will oscillate around a quantization
step.
Regardless of whether you assume random or worst-case noise, the way to
analyze it is to treat the quantization gain as a signal that's injected
at the quantizer, do a sweep to find the transfer function from there to
your output, then plug in one of the above two assumptions and see what
the noise is on your output.
Shameless plug: this method of treating quantization is covered briefly
in my book "Applied Control Theory for Embedded Systems". You'll find it
mentioned briefly in chapter 8 (Nonlinear Systems), and in depth in
chapter 10 (Software Implications).
http://www.wescottdesign.com/actfes/actfes.html
If you find that your PWM is too coarse to give good quantization
behavior, you may also find this article to be of benefit:
http://www.embedded.com/design/configurable-systems/4006431/Sigma-delta-
techniques-extend-DAC-resolution
or
http://tinyurl.com/9dr5y5p, if you are long-URL challenged.
Note that you need to pay attention to the output filter bandwidth, and
that going to a 2nd-order sigma-delta modulator may be beneficial if you
can stand the code complexity.
--
My liberal friends think I'm a conservative kook.
My conservative friends think I'm a liberal kook.
Why am I not happy that they have found common ground?
Tim Wescott, Communications, Control, Circuits & Software
http://www.wescottdesign.com