|
Part 3: The Bottom Line
by Aubrey Kagan
Start ý Calculating
The Odds ý Strange Occurrences ý Can
You Relate? ý Nothing Up My Sleeve
ý Source and PDF
CAN YOU RELATE?
Regression is a technique derived from
statistical applications where you try to find a linear relationship
between a single output and several inputs. Statistically, this may
be a method of predicting the performance of an athlete based on his
weight, height, and foot size. An engineering application may be predicting
the angular speed of a motor driving a water impeller based on the
control signal and the fluid pressure.
Often the relationship is not known, but
you can empirically measure the output for a given input. Letýs assume
your application is to control the above pump though a PWM signal
that can be adjusted from 0% to 100%. Also assume that the fluid pressure
has a negligible effect on the revolutions per minute of the motor.
Youýd apply the PWM signal to the motor and measure the revolutions
per minute for different PWM inputs. Example6a.xls (download
Excel files ) shows some fictitious
results (see Photo 2). I have also added a graph to compare the prices
(download
Example9a.xls from Excel files
).
|

(Click
here to enlarge)
|
Photo 2ýThe initial
input of fictitious data relating PWM output to a motorýs revolutions
per minute is seen here. The inset graph has the points linked
by straight lines. |
To use the regression for a linear relationship,
make sure you click in the spreadsheet away from the graph. Go to
Tools/Data Analysis, scroll down, and select Regression. Enter the
data as shown in Photo 3. The y-axis is the dependent range, and the
x-axis is the independent variable. The output range will put all
the results on the same page.
|

(Click
here to enlarge)
|
Photo 3ýThe user
input is similar to other Excel functions requiring the selection
of input and output cells. |
On completion, the results appear as
shown in Photo 4. Looking at cells C32 and C33, it is apparent that
the linear formula is rpm = 129.3 ý PWM ý 2655. I added the calculation
in column D (see Example9b.xls (download
Excel files)) in order to add the line on the graph (=$C$33*A5+$C$32
in cell D5 and so on). Photo 5 shows the resultant line with the
original curve.
|

(Click
here to enlarge)
|
Photo 4ýThe regression
result using a linear model is seen here. The y-intercept is given
by the value in cell C32 and the slope appears in cell C33. |
|

(Click
here to enlarge)
|
Photo 5ýHere you
can see a comparison of linearized results with the original curve.
Both the original curve and the straight line appear on the graph. |
It may be that the linear relationship
is OK to the first approximation, so you can leave it at that. Between
you, me, and the lamppost, I derived the revolutions per minute from
a quadratic equation, rpm = 1.2 ý PWM2 ý 2.7 ý PWM ý 15.
PREVIOUS
NEXT
Circuit Cellar provides up-to-date information for engineers. Visit
www.circuitcellar.com for
more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com
or subscribe online.
ýCircuit Cellar, the Magazine for Computer Applications. Posted with
permission. |