0
$\begingroup$

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: positive coefficients

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?

$\endgroup$
1
  • 1
    $\begingroup$ 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. $\endgroup$ Commented Feb 25, 2022 at 2:48

1 Answer 1

1
$\begingroup$

After that, the output is the same. Nothing changes.

That is not true, you are just looking at it the wrong way. The waveforms are decidedly differently, so why don't you plot them and look at them directly.

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$.

If you only flip one of the odd terms, the magnitude spectrum will actually change as well since now the odd harmonics of the 5th and 7th term will interfere differently than before.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.