Closed ferreiradiego closed 3 years ago
There is a need to use function like:
Instead of previous designed function:
With the latter one (fucntion without "+c") it's not possible to get zero ppb when the ratio is equal to one. So you will always get some concentration (at least 9.4783) in case that you use the latter function (function without "+c"). In extras/datasheet/ you can find files mq131_high_fit.py and mq131_low_fit.py which I designed for calculation of required a,b,c coeficients. If you want to make the function fit the lower concentration more precisely (trade-off would be that it will have bigger error on higher concentrations) you can play with sigma parameter in mentioned python scripts. Right now the higher fitting priority is set-uped for the first and last point of the curve (0 concentration, max concentration). You can add higher priority also to 10, 50 ppm/ppb points - by changing sigma line to sigma[[0, 1, 2, -1]] = 0.01
In the last version, some changes was did. I didn't get it why the code
return convert(9.4783 * pow(ratio, 2.3348), PPB, unit);
was modified toreturn convert((10.66435681 * pow(ratio, 2.25889394) - 10.66435681), PPB, unit);
. If you compare the table below, you can see that the values in ppb below 200 differs a lot and above 200 the second function it's better.The function in
return convert((10.66435681 * pow(ratio, 2.25889394) - 10.66435681), PPB, unit);
is really better than the other?PS.: I get it that the a and b coeficients changed, but the dubt is in the function with the subtraction of coeficient a.
If also @nitram147 may help me in my doubt I appreciate it