# How to find the function for six step operation

I am trying to find a function for the following scenario:

Rotating the red arrow will produce a nice sine wave as illustrated to the right of the hexagon. But I need to rotate the blue arrow, and at the same time limit the magnitude according to the hexagon. That means that the magnitude will be 1 at every 60 degrees, and decrease to 0.866 at 60+30 degrees before increasing back to 1.

Something like this:

Lastly, i am going to use this varying value in a new sine wave function. That function will look like the dotted curve in the picture below:

But I cannot find the actual function to produce such a curve. (I need it to make a figure about six step operation in electric motor drives)

Hope you can help me

• Piecewise this looks like $\frac1{\sin x}$ (translated, scaled etc.) Commented Jun 18, 2015 at 10:29
• I am not sure if I understand what you mean by that. Plotting 1/(sin (x)) or subtracting it from sin(x) does not make much sense to me Commented Jun 18, 2015 at 10:32
• A function is defined piece-wise if it takes the value of various different functions on a union of disjoint sets, each of which is the domain of one of those functions. Anyway, could you please clarify what you mean by "rotation" of the "arrows"?
– A.P.
Commented Jun 18, 2015 at 12:11
• What I mean by "rotation of the arrows" is that a sine wave is an arrow rotating, but at the same time moving along the x-axis. In electrical engineering, this is called a phasor diagram. Meaning that it is usually three arrows 120 degrees appart, and the lenght indicate the magnitude while the angle indicate the position. I have gained more rep now, so i can add some pictures in my original post later today. Commented Jun 18, 2015 at 23:03
• $$\frac{\cos\left(\frac{\pi}{6}\right)}{ \cos\left(\frac{\pi}{3}\left\{\frac{3x}{\pi}\right\}-\frac{\pi}{6}\right)}$$ where $\{ x \} = x - \lfloor x \rfloor$ is the fractional part of $x$. Commented Jun 20, 2015 at 4:20

One way to approach this is to note that the six sides of the hexagon are straight lines, find the equation of each, then find the intersection of the blue arrow with the correct one. Once you have the angle, you know which side you are interested in. For example, if the angle is between $120^\circ$ and $180^\circ$ you are on the upper left side. If the side of the hexagon is $s$, that line is $y=\frac {\sqrt 3} 2 x -s$ If the angle is $\theta$, you are on the line $y = \tan \theta x$. Solve these together and you get $$x=\frac s{\frac {\sqrt 3}2-\tan \theta}\\y=\frac s{\frac {\sqrt 3}2-\tan \theta}\tan \theta$$
I'm not 100% sure if you want this, but when take the complex function $$\left(1-\left(\sqrt{1-\left(\arcsin\left(\sin\left(6\frac t2\right)\right)/\pi\right)^2}-\frac{\sqrt{3}}2\right)\right)*\exp(it)$$ and plot real against imaginary parts, this looks like a hexagon:
$\hskip1.7in$