continuous piecewise linear approximation of data set

12 visualizzazioni (ultimi 30 giorni)
I'll try to explain my problem: i'm studying the vertical profile of a railway. in a nutshell it's composed by a succession of straights and circles (tangents to the straights between which they are included). my data set is composed by survey points, measured along the railway with an uncertainty; my goal is to approximate this data set with a succession of straights and tangent circles (with the center on the bisector of the two straights in which it's included), such that certain constraints are respected (the most important concerns deviations, so i have to set lower and upper bounds).
I'm developing an algorithm that recognize (or try to) if the survey points belong to a straight or a circle (simply, computing of the change rate of gradient). after having cataloged all the points in the single lines and circles (i have the point group that belongs to the first straight, the point group that belongs to the second straights and the point group that belongs to the first circle, tangent to the first two straights.... and so on...). So, i need to approximate all the points groups that belongs to tangents with a continuous piecewise linear function, respecting lower and upper bounds constraints.
I've tried to write an algorithm using lsqlin for every single straight group points, but obviously the result is a discontinuous linear function whose vertices are not where I would like, i.e. included between the two groups of points belonging to the lines (so that i can then find the bisector and determine the center of the circle tangent to the two lines and that best approximates the survey points belonging to the circle). I hope someone has a good idea to join with mine to solve the problem in an elegant and general way.
Best Regards

Risposte (1)

Bruno Luong
Bruno Luong il 10 Apr 2021
Modificato: Bruno Luong il 10 Apr 2021
  2 Commenti
alessio morabito
alessio morabito il 10 Apr 2021
Hi Bruno. Thanks for your answer. I've tried your function, but the result (in image, where blue points are the groups of points i have to approximate, each one individually) is not perfect... i think the problem is that i have to force the optimization in the x-values of the straights points groups, but i don't know how to do it
Bruno Luong
Bruno Luong il 10 Apr 2021
"i think the problem is that i have to force the optimization in the x-values of the straights points groups"
I don't understand what you mean by that.
If I do I can help.
The fit is poor IMO, you should much better than this. If you provide the data I might better help.

Accedi per commentare.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by