2

First of all, I am not very good at math, and I am a programmer who develops (web)applications

I was working on a web-app which is used for training on a stationary bike, it is used with smart bikes of which the resistance can be controlled.

What I needed to build was a way to keep the output wattage within a range.

I have solved this in code by increasing and decreasing the value of the resistance around the min and max values.

Here is a crudely drawn graph of what it does.

Graph

Is there an equation which would plot this graph with the min and max values as the input?

And what would you call this graph with the 2 exponential curves?

Sorry if this question is unclear, or if this is not the correct place to ask.

Nick Hooked
  • 123
  • 4

1 Answers1

3

Here is a solution.

Let $[m,n]$ be the [min,max] interval in which you want a flat part.

Take the following function:

$$\begin{cases}y&=&a+b \left(\sin(\ell(x)) - \ell(x)\right) \ \text{where}\\ \ell(x)&=&c \frac{2x-(m+n)}{n-m}\end{cases}$$

based on the "mother function" $y=\sin(x)-x$ with parameters allowing to modulate the curve in different ways : height, width, etc. ; one can take for example $a=5,b=1,c=1$ at the beginning.

enter image description here

Edit: Have a look at the green curve with parametric equations:

$$\begin{cases}x(t)&=&8-1.5t+\sin(t)\\y(t)&=&7+t+\sin(t) \end{cases}$$

that can maybe constitute a better basis for answering your issue.

Linear algebra remark:

This type of curve is obtained as an image of the "mother sine" curve by the following affine transform:

$$\pmatrix{x(t)\\y(t)}=\pmatrix{a&b\\c&d}\pmatrix{t\\ sin(t)}+\pmatrix{e\\f}$$

for certain well-chosen coefficients $a,b,...f$.

Jean Marie
  • 81,803
  • Nice. But I think the OP wants another inflection point so that the curve starts out cap shaped. – Ethan Bolker Nov 22 '22 at 22:46
  • Great, this is definitely what I was looking for! Thank you. @EthanBolker, yes I do want the curve to have a cap at the start, but I actually want it to act different for when the value for the x axis is increased from below the min value or when coming from above the min value. – Nick Hooked Nov 23 '22 at 13:54
  • 1
    @Ethan Bolker In fact, due to the periodicity of sine function, one has this "cap shape" on the left. – Jean Marie Nov 23 '22 at 16:33
  • @JeanMarie Yes. You or the OP will have to shift to make it appear. – Ethan Bolker Nov 23 '22 at 16:38
  • @Ethan Bolker Done. Please see the edit I have added. – Jean Marie Nov 24 '22 at 13:53