calculating running frequency of a line graph

tsl

New Member
Licensed User
Longtime User
hi i was hoping for some help with calculating the frequency/minute from a line graph, displayed as a continuous value with updates every second, i.e using the accelerometer to calculate the revolutions per minute of a wheel/ frequency per minute of an accelerometer/oscilloscope graph and then using this value to calculate something else to be plotted onto a line graph

sorry if this is a very basic question! any help would be appreciated

thanks
 

kanaida

Active Member
Licensed User
Longtime User
First gather the data.

I havent tried looking at compass/magnetometer data but you'd need a sort of radious formula taking into account speed.

a) The diameter of the wheel (at the location of the attached sensor)
b) use the magnetometer data to determine G force
Do some kind of math to figure out how much time it takes at the current speed to make a full revolution, wait that long before taking the next measurement and store the value +1 in a variable for the current time slice ( a timer every second). After each timer.tick() reset the internal value and append the old value to a growing list of values that accumulate for each time slice.

Then take the largest collected value * around 1.25 and store it a a MAX grid height value. after that draw bars, lines etc... as percentages of that height. Starting at some offset once you have too much data to show in one grid (so it moves like the windows task manager cpu).
You can take the easy route and simply use a fixed number colored panels beside each other in some parent panel of a different color.

Look up my LG connect Optimizer in the "show my creations" section of this forum. it's what I do to vertically show lines for the time spent at each cpu speed. yours would just go in the opposite direction probably and tighly closer together. Another way would be to draw a polygon and draw it in a canvas.

There might be easier ways to get the magnetometer data, or interpret that it went int a loop once. You could use that to avoid complex math, just spot a particular pattern like maybe when the Z value becomes negative (if it's 3d, not sure)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…