Find ratio / division between two numbers

474 Views Asked by At

I am reverse engineering custom software for a stepper motor. The original software eases in and out of any motion, and the duration of the ramping up to speed is directly related to the speed that the motor is ramping up to.

In other words, when the motor is ramping up to a high speed, the duration of the ease-in is short / it eases in to the high speed quickly. When the motor is ramping up to a slow speed, the ease-in is long / it eases in to the slow speed slowly.

Here are some samples, with the caveat that there is potential for a .030 second margin of error in the ease-in durations...

Hz        duration of ease-in
324       1.139
390       1.134
403       1.167
410       1.1
423.4     1.1
693.5     0.766
1040      0.567
1134      0.567
1480      0.434

How can I find the relationship between Hz and the ease-in duration, so that I can derive the proper ease-in duration from a given Hz?

3

There are 3 best solutions below

8
On BEST ANSWER

As already said in comments, it could be good to have more data points.

It is not sure that a linear model is the most appropriate. You effectively obtained $$y=1.374 -0.000697369 x$$ to which correspond a sum of squares equal to $0.0381$ and $R^2=0.9951$.

Using this model, what would happen when $\text{Hz} > 2000$ ? Is a negative duration of the ease-in possible to consider ?

Looking at the scatter plot of the data, we could also think about an hyperbolic model (this is again a linear regression) $$y=0.268936 +\frac{328.735}{x}$$ to which correspond a sum of squares equal to $0.0362$ and $R^2=0.9954$.

Update

Using all the data you stored here : a scatter plot of $y$ as a function of $x$ clearly reveals that the model is nonlinear. At the opposite, plotting $xy$ as a function of $x$ clearly shows an almost linear trend. Then, the idea of an hyperbolic model as suggested earlier. Using all the data points, a least square fit leads to $$y=0.269704 +\frac{342.283}{x}$$ to which correspond a sum of squares equal to $0.1028$ and $R^2=0.9970$.

The following table reports your data and the fitted values $$\left( \begin{array}{ccc} 128.2 & 2.934 & 2.940 \\ 173.5 & 2.167 & 2.243 \\ 271.7 & 1.600 & 1.529 \\ 312.0 & 1.366 & 1.367 \\ 324.0 & 1.139 & 1.326 \\ 370.0 & 1.300 & 1.195 \\ 390.0 & 1.134 & 1.147 \\ 402.0 & 1.200 & 1.121 \\ 403.0 & 1.167 & 1.119 \\ 410.0 & 1.100 & 1.105 \\ 416.0 & 1.200 & 1.093 \\ 423.4 & 1.100 & 1.078 \\ 423.4 & 1.167 & 1.078 \\ 441.0 & 0.967 & 1.046 \\ 693.5 & 0.766 & 0.763 \\ 925.0 & 0.667 & 0.640 \\ 1040 & 0.567 & 0.599 \\ 1134 & 0.567 & 0.572 \\ 1190 & 0.566 & 0.557 \\ 1195 & 0.533 & 0.556 \\ 1200 & 0.566 & 0.555 \\ 1387 & 0.500 & 0.516 \\ 1480 & 0.434 & 0.501 \\ 1782 & 0.400 & 0.462 \end{array} \right)$$

which seems to be quite good.

3
On

I'd recommend getting a few more frequencies and measuring the ease-in duration for those frequencies.

With just two points it's complete guesswork. All we can say now is that it appears to be some kind of inverse relationship: higher frequency implies shorter ease-in duration.

1
On

I was able to plot the data set and find the linear regression.

Intercept (a): 1.3739956457219 Slope (b): -0.0006973690931099

So, Y = a + bX

This works with a pretty decent level of accuracy for my purposes – accurate to .02 seconds.