Delta X-Y
Hello to all!! I am working on a school project and my idea is to have a list of data that are received with a certain speed, given by the metronome.
I'm trying to make a derivative calculation (delta x, delta y, speed, acceleration, etc.), but to do this I would have two data available for comparison: the next and the previous one (so that if I want to calculate a delta X between line 2 and line 1, with the simple formula “(xm + n) - xm”)) (or similar things :)) But I don't know how to have these two data to put in "expr"!
I still have little experience with Max..
Here is my patch, I hope someone wants to have some fun with it :)
Thanks in advance..
I don't remember if there is a Max object that does the calculation of difference of successive numbers outside of gen, but gen in general might be a good solution for you.
In gen you can use [delta] for discrete derivative. You can also use codebox for other calculations. Codebox allows to use a more convenient syntax and you won't need [expr].
Edit: This here https://cycling74.com/tutorials/my-favorite-object-bucket also covers the topic using [bucket] and also includes a moving average. Smoothing your data may be necessary otherwise noise might influence your derivative in an unwanted way.
sometimes [zl.stream 2] can be of help - but it is a better exercise to set up a register and control message order using a trigger object.
[110.delta]
[t i i b]
I ............... X
I ............... [i 0]
I ............... I
[- 0]
MARTIN: Thank you very much, I will try to carefully study this approach, but it doesn't seem so simple in development ... am I right?
ROMAN: Many thanks too, actually I tried to use the zl.stream object, but definitely bad. I was unable to decipher your message: [110.delta] [t i i b] I ............... X I ............... [i 0] I ............... I [- 0] --->>What does it mean in terms of patches?
Here the developments, but surely I have taken a wrong path...