2

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?

dongle
  • 143

3 Answers3

1

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.

John
  • 26,319
1

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.

dongle
  • 143
1

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.

  • Yes, as I have gathered more data points it appears that it is definitely a curve, and that linear regression would be insufficient. I've opened a new question about polynomial regression here: http://math.stackexchange.com/questions/1812854/how-to-find-point-in-polynomial-regresion – dongle Jun 05 '16 at 13:48
  • The hyperbolic equation you provided is providing very accurate fitting – it may indeed be close enough for my real-world application. I have compared it to the actual data, as well as linear regression here: https://docs.google.com/spreadsheets/d/15lWCe6lrT_mCEgIawcjiQtAT5V4yPdn8JR4aTDTbesk/edit?usp=sharing – dongle Jun 05 '16 at 14:25
  • @dongle. I even think that we could do better. Are all data points in the link . If they are, I shall have a look tomorrow morning. Cheers. – Claude Leibovici Jun 05 '16 at 14:32
  • Those are all of the data points I have right now. I can gather more, but it takes a bit of time. – dongle Jun 05 '16 at 14:38
  • @dongle. It is fine. I shall work with these. – Claude Leibovici Jun 05 '16 at 15:05
  • Ok - I have gathered and added samples of all unique Hz, and their actual ease-in value... also the good news - the weird outlier at 480 Hz was a typo! – dongle Jun 05 '16 at 15:35
  • @dongle. I updated my answer. – Claude Leibovici Jun 06 '16 at 03:29
  • Thanks! Even better fit :-) – dongle Jun 14 '16 at 21:02