# Signs of waveshaping polynomial coefficients

I'm playing with some basic functions for distortion purposes. Odd order polynomials generate odd harmonics, even order polynomials generate even harmonics. When I combine them, both types occur at the same time.

I'm not too sure how to articulate my main question, so I'd like to share the code and its output to try to explain my curiosity through it. Here is the Matlab code for generating multiple harmonics of 220Hz sine wave:

   Fs = 44100;
dt = 1/Fs;
StopTime = 1;
t = (0:dt:StopTime-dt)';
N = size(t,1);

Fc = 220;
x = sin(2*pi*Fc*t).^5 + sin(2*pi*Fc*t).^6 + sin(2*pi*Fc*t).^7;


Above code generates 1st, 2nd, 3rd, 4th, 5th, 6th and 7th harmonics, here is the output:

My own little experiment is this: I made the signs of sin(2piFct) to the 5th and sin(2piFct) to the 7th negative waiting for the spectrum to change(could be complete delusion, lack of knowledge. please enlighten me). Code:

   Fs = 44100;
dt = 1/Fs;
StopTime = 1;
t = (0:dt:StopTime-dt)';
N = size(t,1);

Fc = 220;
x = -sin(2*pi*Fc*t).^5 + sin(2*pi*Fc*t).^6 - sin(2*pi*Fc*t).^7;


After that, the output is the same. Nothing changes. In such a polynomial, what difference does it make to make all the odd powered coefficients's signs negative and vice versa? Could it be related to FFT that there is no change? If so, at what stage does the change I expect from the minus sign neutralized?

• Two things: 1. Try not to use the term "transfer function" with anything non-linear. We signal processing geeks associate transfer functions with linear, time-invariant (LTI) systems. 2. One thing that I might suggest to look into are Tchebyshev polynomials. They can help you relate exactly which harmonics are created with waveshaping and how much amplitude each has. Commented Feb 25, 2022 at 2:48

The reason why the spectra are the same is that you are only plotting the magnitude and not the phase. When you invert the odd harmonics their magnitude stays the same, but the phase increase (or decreases) by $$\pi$$.