# Digital Distortion Modeling

• haminous
In summary, the simplest way to model nonlinear behavior is in the time domain. If the response is for periodic (but non-sinusoidal, and amplitude dependent) then the Harmonic Balance Method can be used. Otherwise, trying to model nonlinear systems in the frequency domain can be a seriously hard problem.f

#### haminous

So I've been having a bit of fun with FFT's of some nonlinear functions applied to sine waves and I noticed 'reflection' of the harmonics due to generation of frequencies beyond the Nyquist frequency. This comes as no surprise, but it left me wondering how one might model nonlinear systems without generating erroneous frequency components (in a guitar effects pedal, for instance). Is there a clever way to do this or does one have to 'brute force' it by massively oversampling and filtering?

If you're keenly aware of what you want to happen in the frequency domain, you might be able to design the frequency response that you want, then sample it and take its inverse FFT. The result will be an FIR filter kernel. You can convolve this with your input to get any kind of frequency-domain behavior you want, without introducing frequencies higher than Nyquist.

On the other hand, an FIR filter is a linear filter, so it can only approximate the behavior of the non-linear filter. Maybe the part that sounds good to the ear can be modeled linearly, though?

- Warren

The simplest way to model nonlinear behavour is in the time domain.

One way to do it in the frequency domain if the response is for periodic (but non-sinusoidal, and amplitude dependent) is the Harmonic Balance Method (HBM or IHBM).

On the other hand, some nonlinear systems can generate responses that are unrelated to anything in a "linearised" (small-amplitude) model of the system or the frequency of the input force, and trying to model that in the frequency domain is a seriously hard problem.

The output from any frequency domain model tends to be restricted by the assumptions you made in setting up the model, and if those don't correspond to what the real system can do the "answers" can range from useful approximations to completely wrong. You need some independent information (either a time domain model, or some measurements) to validate what you get.

There is no particular problem in having a large (even infinite) frequency range in a FD model, but (as your OP implied) you need to careful about aliasing etc when converting between the time and frequency domains. This is often an artefact of using sampled data to represent the time domain, not something that is intrinsic to "real world" analog nonlinear systems.

chroot, ...
...thanks for the suggestion, but in this case it's specifically harmonic generation due to nonlinear effects that I'm interested in analyzing so an FIR wouldn't quite do it here.

AlephZero, ...
...it's precisely those aliasing 'artifacts' that I would like to avoid for exactly the reason you stated - it doesn't represent the real world system. It seems like I'm caught somewhere between the simple time domain modeling (which is what I've been doing) and needing something that represents a more accurate frequency-limited model. Thanks for your insights. I've never heard of the HBM method before; it looks fascinating. Sounds like this is a tough problem in general. Ironically enough, I'm actually working on analysis of nonlinear harmonic generation for the purpose of making these kinds of problems simpler.

On a sidenote, does anyone know of an analog circuit that can produce either a hyperbolic tangent or logistic function of its input?