advanced graphing

Hello everyone, so I was teaching some members of the team how to do what I call advanced graphing and I realized how little they knew and I am pretty sure that not many other people know how to do advanced graphing so I made this conversation… So advanced graphing is when you take a data table and make it into an equation. Sounds simple at first but when the graph is quadratic or radical (y=x^2 and y=1/x) and then add some noise then people tend to get lost. The first step is to get rid of the noise unless your data is naturally quiet in which case skip to step 2. The most common way to do this is to graph the points then draw a line of best fit (see photo). The next step is to make your data linear. Choose a couple of points from the line you just drew and make a new data table with those new points. The more points you get the more accurate your equation will be. If your data is linear (a straight line) to begin with, then skip to step 3. Take a look a your graph, and choose what parent function it resembles most or decide some other way what the parent function is. common parent functions are quadratic, radical, and square root (and linear). If your data is quadratic, then square your “x” values you got from earlier in step 2. If your data is radical, put 1/your “x” values from earlier in step 2. If your parent graph is y=sqrt(x) then square root your new “x” values. graph your new data. If the data is not linear then try another parent function and check your math. If your data is still not linear then your data has a ton of noise or there is no pattern between the x and y in which case you cannot make an equation. Step 3 is to find the equation of your linear data. draw a line of best fit through the graph your linear data and find the equation of the line by finding the slope (y1-y2)/(x1-x2) and the y intercept (y1-x1slope) which can give you the slope intercept form y=slopex+y-intercept. Step 4 is to find the equation you have been looking for this entire time. Take your slope intercept form equation and if your parent function of the original data was linear then you are done, if your original data was quadratic, then slopex^2+y-intercept is your formula. If your original parent function was y=sqrt(x) then your equation is y=slopesqrt(x)+y-intercept and so on. You may want to graph your new equation and the line of best fit you drew in step 1 and see how far apart they are. They should be almost identical. If they are not, retry all of the steps and check your math. My final note on advanced graphing is situations where it can be applied such as how fast the flywheel needs to spin any distance from the net, how much power to give the motors at any battery level to achieve the same output torque or speed, the speed or torque of a motor at x power, etc. If you are still confused on the subject try a couple practice problems and look here (http://www.mrwaynesclass.com/labs/reading/index06.html). If I made any mistakes PLEASE let me know.

This is like graph straightening in physics right?

Um. So, to sum it up, do some straightening and then do linear regression, then substitute back, right?

In VEX I see this will be useful with the motor voltage vs. practical speed curve.

I guess you can do all sorts of regression, radical, quadratic, logarithmic, fairly easily in Excel or whatever computation software for practical competition use. But it is useful to know how exactly it is done.

Pretty much.

Yes

I can read thank you very much.

Chill man, he was just answering you question.

Just clarifying that I had already seen and understood @OverlyOptimisticProgramer 's answer to my question. Nothing more and nothing less.

well he probably also wanted to answer it as well.

This is something that worked really well for 81M back in Sack Attack. It worked so well it allowed for a single driver for lifting sacks and keeping the arm in a perfect 45 degree scoop hold as you drove around. Another button changed the target to either lift or floor level formula.

Make a function of two variables - when the arm pot says this, your target scoop pot will be something else. Yours had Flywheel speed vs distance. So if you have distance from goal, you could change the flywheel speed dynamically. You could also do angle if you had a variable lift angle on a pinball shooter.

However Excel makes it so much easier. Using the linear regression formulas within the graph works just as well as the by hand methods. So for sack attack, it was a two stage arm and you want to not drop the sacks out too early as you drive. So using a level app on your iPhone can get you the proper angle you want as you adjust the lift arm and make a function of arm potentiometer vs scoop petentiometer to make a set 45 degree scoop where the sacks don’t fall out.

Linest() in Excel is also how you can do it by hand, but add the regression lines right on the graph in one click. Look at the R-squared value to see how close you are to fitting the function. You can go back and back calculate at the function against the typical positions to make sure the error is not practically too far off. See the attached for the graph.

P1020304 by Glenn McMillen, on Flickr

Put that function as the basis of an error in a PID loop, and it will be pretty darn good. Your error is not going against a fixed value but against what you want for that arm position. In yours it would be distance from goal to flywheel speed.

Getting hyper accurate distance calculations as you move is another discussion… (figure out shear, then rotate, then translation)