Let say I've this sine wave (which is sin(x * 2)):
and I want to increase/decrese the ramp such as (sorry for my paint):
I need to multiply the argument for... what? Tried log(x) but I get strange results.
Let say I've this sine wave (which is sin(x * 2)):
and I want to increase/decrese the ramp such as (sorry for my paint):
I need to multiply the argument for... what? Tried log(x) but I get strange results.
It will be hard to do that by modifying the argument of the sine. Much easier to modify the result of the sine. More precisely, you want $$ f(\sin(2x)) $$ where $f$ is some function that
There are many ways to achieve conditions (1) to (3) -- the simplest would would be to let $f$ be a cubic polynomial -- but most of them don't achieve (4) for all desired slopes.
The nicest solution I can find is $$ f(x) = \tanh(m \tanh^{-1}(x)) $$ where $m$ is the factor by which you want to increase the slope at the zero crossings of your curve, and $\tanh$ and $\tanh^{-1}$ are the hyperbolic tangent and arctangent: $$ \tanh(x) = \frac{e^{2x}-1}{e^{2x}+1} \qquad\qquad \tanh^{-1}(x) = \frac{\ln(1+x)-\ln(1-x)}2 $$
That's a bit more involved than you probably expected, but I can't find any nice smooth family of rational functions that work for every $m\ge 1$.
This function can also decrease the slope at the zero crossing slightly, though if you use an $m$ less than about $0.75$, the resulting curve will have an inflection point somewhere between the zero crossing and the peak. (Such an inflection point is of course unavoidable when $m\le 2/\pi\approx 0.64$, because even a straight line with such a slope at the zero crossing would not rise high enough to reach the peak).
The simple $$f(x) = mx - (1-m)x^3 $$ will still work when $0.87 < m \le 1.5$.
If the range $0.85<m\le 2$ is sufficient for you, you may also try modifying the argument to the sine instead with $$ \sin\left(2x+\frac{m-1}2\sin(4x)\right) $$
For fun, I'll propose a solution which is based on a bit of electronics. The result will be similar to that proposed by Henning Makholm with some free parameters. Of course, such a problem has no unique solution.
In the language of electronics, you need a device -- an amplifier -- that has a small signal gain of $A$. Small signal gain means that the device amplifies a signal by $A$ only in the vicinity of 0. Far from zero, real amplifiers "saturate" toward a maximum or a minimum value, which in your case could be $\pm 1$.
Now, there exists a circuit called bipolar differential pair, whose (static) input-output characteristics can be written as (I use generic symbols, not those used in electronics):
$$y_\mathrm{o} = Y_\mathrm{om}\tanh(S y_\mathrm{i})$$
where $y_\mathrm{i}$ and $y_\mathrm{o}$ are, respectively, the input and the output quantity, $Y_\mathrm{om}$ is the maximum output value, symmetrical for positive and negative outputs, and $S$ is a scaling factor.
In your case, you can set $y_\mathrm{i} = \sin 2x$.
What about the small signal gain? Well, this "gain" is nothing but the derivative of the function about 0:
$$A = \left.\frac{\mathrm{d}y_\mathrm{o}}{\mathrm{d}y_\mathrm{i}}\right|_{y_\mathrm{i}=0} = SY_\mathrm{om}$$
Thus, if you want an output bounded between $\pm 1$ by multiplying the slope of the zero crossings by $A$, you can choose $Y_\mathrm{om} = 1$ and $S=A$. This yields, finally,
$$y_\mathrm{o} = \tanh(A \sin 2x)$$
This solution, as is, does not allow you to have a maximum output equal to the maximum input.