differences between minimum, trough and maximum and peak? Are these objects reliable?
Hi,
I have a list of incoming values from a sensor. I am trying to determine the lowest value, highest value and average value. Maybe I am doing something wrong, but it seems like there are issues with some of these objects for these sorts of tests, or there are some bugs somewhere. Also I am using all of these objects with floats.
With minimum if I put a float object as it's input and I enter in low number values it will record them, but when I add high values it will out put those as well, so they clearly aren't the minimum value. Perhaps there is a limit to how many numbers this object can test?
I get the same thing with maximum object.
With trough I don't have this problem. But when I connect it to the sensor it is getting a really low value that is not coming out of the sensor. I can see the values coming in so I know that it can't possibly be getting these super low numbers. So trough is kind of useless for this task as well. I tried resetting the trough minimum periodically but that doesn't help.
I think the peak object seems pretty reliable. Does anyone know of any issues with that that I haven't encountered yet?
Thank you all for your help and information.
I am just noticing another strange behavior. I don't think it changes my above post, but I want to add this.
I am getting these errors in the Max console:
trough: doesn't understand "15.15."
number: doesn't understand "15.15."
float: doesn't understand "15.15."
number: doesn't understand "15.15."
float: doesn't understand ".15.12"
number: doesn't understand ".15.12"
I am coming out of a serial object, translating the values into decimal values, then going into a float object. I don't know why the decimal point is moving around, or sometimes there are 2 decimal points. but it could be what is resetting the values, or setting them really low.
Does the float object discard values like 15.15 and .15.12? or do those get passed down to the trough and peak objects?
Without seeing your patch, it's a little tough to figure out what your problem might be, with the exception of the flonum object not understanding a number with two decimal places.
I expect you may need to look at your serial output. This works just fine.
i'd (re)read the documentation on maxiumum/minimum. They are meant to compare two numbers or a list of numbers, not report the maximum or minimum of all numbers received. peak and trough seem like the right objects for what you are trying to accomplish.
to troubleshoot your other issue, i'd recommend printing out the direct output of your serial object and seeing what you are getting. I would assume that is where the problem is but hard to say without seeing the patch and the input.
Hi everyone,
Thank you for the info and suggestions.
I posted my patch below. Max Gardner thanks for the example. I saw that you are resetting the minimum and maximum argument each time it changes. I will implement that.
I think trough and peak actually seem ok, and the inconsistency might have to do with the decimal point issue. I guess the new problem is how to filter out these bad numbers. I might lower my sample rate to get cleaner values. It might also have to do with the zl group object in my patch. Maybe I can bypass that somehow, but I haven't figured that out yet.
If you have any suggestions please let me know. Thank you again.
Remove the 6 from the [zl group 6]. It should wait for a linebreak and then output the values in zl.group by using the bang from the [sel 10 13]. Make sure you end your message with a Serial.println() in your arduino code so you are printing linebreaks (this is what the number 13 is). Then the patch will gather everything before the linebreak in the zl.group and output when the linebreak is received.
Hi Timo,
Wow that's great info. I'll give that a try. Thank You!