How to reduce data irregularly?
15 vues (au cours des 30 derniers jours)
I have a plot consists of 10000 points that I need to reduce to upload it on an instrument which accepts only 200 points. The plot consists of three parts: first a straight line, a curve and again a straight line. I want to reduce the number of points like getting a small number of points for both lines and get more points for the curve. How can I do that?
Star Strider le 17 Sep 2021
One approach would be to use the gradient function to calculate the derivative of the available data. This will be greater than 1 (or different from a constant, depending on what the striaght lines are). Then randomly select points from the identified curve, and most likely adjacent points on the line (for example the last 5 before the curve begins and the first 5 after itt is defined to end). (These would be sorted by their independent variable values so the independent variable values are increasing.)
The gradient function is preferable to diff because the output is the same size as the input, making indexing easier.
Kelly Kearney le 17 Sep 2021
It sounds like you're looking for a line simplification algorithm. These algorithms try to preserve the shape of a polygon or polyline while reducing the number of points used. The Mapping Toolbox includes a version of the Douglas-Peucker method (reducem), and it looks like there are some FEX options (maybe this one?) available as well if you don't have that toolbox.