1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Dealing with a nonlinear system of equations.

  1. Oct 27, 2012 #1


    User Avatar

    1. The problem statement, all variables and given/known data

    Hello everyone.

    I'm trying to solve a non linear 11x11 system. (for eliminate harmonics in a power inversor)
    I used Excel's Solver but it didn't work. (Solver couldn't solve the system). Then I found fsolve (a scilab function) but again it didn't work
    I will attach the code used.

    2. Relevant equations

    The system is:

    The letters are the unknown angles which are desired.
    n represent the number of the harmonic because harmonics 3rd, 5th, 7th, 9th,11th, 13th, 15th, 17th, 19th, 21st, 23rd must be eliminated. They are 11 angles so there are 11 simultaneous equations to solve to find the angles which can eliminate those harmonics.

    Who knows another method to solve the system?

    3. The attempt at a solution

    When i change the initial value in the script i got different solutions, when i substitute I found out that solution is actually false.

    code used in Scilab:

    function t1 = system (a)
    fa(1)= cosd(3*a(1)) - cosd(3*a(2)) + cosd(3*a(3))- cosd(3*a(4))+ cosd(3*a(5))-cosd(3*a(6))+ cosd(3*a(7))-cosd(3*a(8))+cosd(3*a(9))- cosd(3*a(10))+cosd(3*a(11));
    fa(2)= cosd(5*a(1)) - cosd(5*a(2)) + cosd(5*a(3))- cosd(5*a(4))+ cosd(5*a(5))-cosd(5*a(6))+ cosd(5*a(7))-cosd(5*a(8))+cosd(5*a(9))- cosd(5*a(10))+cosd(5*a(11));
    fa(3)= cosd(7*a(1)) - cosd(7*a(2)) + cosd(7*a(3))- cosd(7*a(4))+ cosd(7*a(5))-cosd(7*a(6))+ cosd(7*a(7))-cosd(7*a(8))+cosd(7*a(9))- cosd(7*a(10))+cosd(7*a(11));
    fa(4)= cosd(9*a(1)) - cosd(9*a(2)) + cosd(9*a(3))- cosd(9*a(4))+ cosd(9*a(5))-cosd(9*a(6))+ cosd(9*a(7))-cosd(9*a(8))+cosd(9*a(9))- cosd(9*a(10))+cosd(9*a(11));
    fa(5)= cosd(11*a(1)) - cosd(11*a(2)) + cosd(11*a(3))- cosd(11*a(4))+ cosd(11*a(5))-cosd(11*a(6))+ cosd(11*a(7))-cosd(11*a(8))+cosd(11*a(9))- cosd(11*a(10))+cosd(11*a(11));
    fa(6)= cosd(13*a(1)) - cosd(13*a(2)) + cosd(13*a(3))- cosd(13*a(4))+ cosd(13*a(5))-cosd(13*a(6))+ cosd(13*a(7))-cosd(13*a(8))+cosd(13*a(9))- cosd(13*a(10))+cosd(13*a(11));
    fa(7)= cosd(15*a(1)) - cosd(15*a(2)) + cosd(15*a(3))- cosd(15*a(4))+ cosd(15*a(5))-cosd(15*a(6))+ cosd(15*a(7))-cosd(15*a(8))+cosd(15*a(9))- cosd(15*a(10))+cosd(15*a(11));
    fa(8)= cosd(17*a(1)) - cosd(17*a(2)) + cosd(17*a(3))- cosd(17*a(4))+ cosd(17*a(5))-cosd(17*a(6))+ cosd(17*a(7))-cosd(17*a(8))+cosd(17*a(9))- cosd(17*a(10))+cosd(17*a(11));
    fa(9)= cosd(19*a(1)) - cosd(19*a(2)) + cosd(19*a(3))- cosd(19*a(4))+ cosd(19*a(5))-cosd(19*a(6))+ cosd(19*a(7))-cosd(19*a(8))+cosd(19*a(9))- cosd(19*a(10))+cosd(19*a(11));
    fa(10)= cosd(21*a(1)) - cosd(21*a(2)) + cosd(21*a(3))- cosd(21*a(4))+ cosd(21*a(5))-cosd(21*a(6))+ cosd(21*a(7))-cosd(21*a(8))+cosd(21*a(9))- cosd(21*a(10))+cosd(21*a(11));
    fa(11)= cosd(23*a(1)) - cosd(23*a(2)) + cosd(23*a(3))- cosd(23*a(4))+ cosd(23*a(5))-cosd(23*a(6))+ cosd(23*a(7))-cosd(23*a(8))+cosd(23*a(9))- cosd(23*a(10))+cosd(23*a(11));

    a0 = [0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1];
    [ar, v, info] = fsolve(a0, system);

    Attached Files:

    Last edited: Oct 27, 2012
  2. jcsd
  3. Oct 27, 2012 #2

    The Electrician

    User Avatar
    Gold Member

    Are you familiar with the papers on this topic that have been published by the IEEE? If so, which papers do you have? I may be able to steer you to some others.
  4. Oct 27, 2012 #3


    User Avatar

    No, my professor gave me only the Fourier coefficients formulas, with these formulas i obtained those equations from the previous post. I solved a previous exercise with Excel (there were only 3 equations, instead of 11).

    Thanks in advance.
  5. Nov 23, 2012 #4
    Varied considerations, I just couldn't resist...

    Here you've chosen a single-ended inverter, sadly for you. An H bridge would give you three voltages +V, 0, -V with more flexibility, like the 1/3 2/3 waveform that suppresses harmonics 3 9 15 21. A three-phase output would do the same for free. Needs fewer transitions per period. A multi-phase inverter, like those feeding a Cpu, does essentially the same to reduce the ripple with one transition per period on each output.

    Solving the equation for c=cos(a) would make it a set of polynomial equations, which I believe to remember is solved by Mathcad or Maple. That is, cos(3a) comprises cos(a) and cos3(a) and so on for higher powers, which you find through cos(a)=[exp(j*a)+exp(-j*a)]/2. Reinjecting the lower-power equations in the higher ones would then simplify them, possibly to contain only the highest power.

    You can perfectly write a dumb software that tries all possible angles. a1 to a11 are between 0° and 90° and are in strict increasing order, so if you try all even degree angles between 2° and 88° you have 3411/11! combinations or 2 billions. Precompute 11 tables of 44 angles for cos(n*a), avoid repeated computations in nested loops, and a single Cpu takes 50 cycles per trial or 30s at 3GHz, without SSE nor multicore. Take the RMS power as a fast figure of merit.

    Then, refine your solution within the (2°)11 hypervolume.

    More subtle, you could keep a few near-best solutions that aren't local to an other, in case the best one is technologically bad, say if the transitions are too close to an other. Or if the 2° sampling lets you miss the true best solution.

    Good luck, I had spent a few thought at this dream when I was a student.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook