# How to calculate a modified sine curve?

I am designing a two dimensional cam profiles. I want to use the "modified sine" method for drawing the position and angle changes. (see attached sketch). The modified sine curve is actually a combination of cycloidal curve at the first and last 1/8 of the curve and a sine curve in the middle 7/8 of the curve. It is easily employed when the terminal velocities are zero. However, often times it is necessary for a cam profile to simply go from one velocity (perhaps zero) to a constant terminal velocity. The terminal velocity is simply an angle on the displacement diagram.

The profile is defined by:

$$y= \begin{cases} \frac h{4+\pi}\left(\pi\frac\theta\beta-\frac14 \sin \left(4 \pi \frac\theta\beta \right) \right), & 0\lt\theta\lt\frac18\beta \\[2ex] \frac h{4+\pi}\left(2+\pi\frac\theta\beta-\frac94 \sin \left(4\pi\frac\theta{3\beta}+\frac\pi3 \right) \right), & \frac18\beta\lt\theta\lt\frac78\beta \\[2ex] \frac h{4+\pi} \left(4+\pi\frac\theta\beta-\frac14 \sin \left(4\pi\frac\theta\beta \right) \right), & \frac78\beta\lt\theta\lt\beta \end{cases}$$

The maximum velocity which can be achieved is at $45\deg \left( \frac\pi4 \right)$ therefore, only the first half of the curve is usable for my need.

as an example,

what method would you employ to design a curve that would go from point $(0,0)$ at angle zero, to the point $(3,2)$ slope $30$ degrees.

What coefficients $h$ and $\beta$ in the above equations will create a curve such that the slope at point $(3,2)$ is equal to $\frac{30}{180}\pi$?

• I think you may have some of your math wrong. The terminal velocity is not actually an angle, but rather the derivative $\frac{dy}{d\theta}$ and the maximum velocity occurs at $\theta = 0.5\beta$. I don't know if you can really solve this problem unless you give a desired slope (velocity) instead of a desired angle. Additionally, units would be much appreciated. – regdoug Mar 18 '15 at 23:03

I would use a Hermite interpolation. It uses the following four functions:

$h_1 = 2s^3 - 3s^2 + 1$

$h_2 = -2s^3 + 3s^2$

$h_3 = s^3 - 2s^2 + s$

$h_4 = s^3 - s^2$

And combines them like this:

$output = (h_1 * startPoint) + (h_2 * endPoint) + (h_3 * gradientIn) + (h_4 * gradientOut)$

The value $s$ in the four functions is your interpolating parameter, as it goes from $0$ to $1$ the $output$ goes from your $startPoint$ $(0, 0)$ to your $endPoint$ $(3, 2)$. Your $gradientIn$ wasn't specified, but looks to be $0$ and $gradientOut$ is as you specified: $tan(\frac{\pi}{6}) = \frac{1}{\sqrt{3}}$ so removing the terms that will multiply by zero (start point and gradient in):

$x_s = (h_2 * x_{end}) + (h_4 * tan(\frac{\pi}{6})) = (h_2 * 3) + (h_4 * \frac{1}{\sqrt{3}})$

$y_s = (h_2 * y_{end}) + (h_4 * tan(\frac{\pi}{6})) = (h_2 * 2) + (h_4 * \frac{1}{\sqrt{3}})$