Minimize distance between curves
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Deepa Maheshvare
am 4 Jul. 2022
Kommentiert: Deepa Maheshvare
am 7 Jul. 2022
I have a dataset with values of multiple curves. An example plot is shown below. I want to scale the curves so that all curves overlap or get closer to the target curve. The following is the plot of a sample dataset
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1054685/image.jpeg)
I want to scale the function values in the curves so that all curves overlap. Say, green curve is the target (g) and I want to move the other curves (f) towards target curve by scaling (scale facotor is a).
The function that I want to minimize is:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1054690/image.png)
Expected result:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1054695/image.jpeg)
Data:
data = {{{157, 60}, {140, 57}, {121, 52}, {103, 47}, {86, 39}, {67, 28}, {50,21}, {32, 15}}, {{159, 70}, {140, 67}, {122, 63}, {105, 58}, {85, 45}, {68, 42}, {50, 34}, {33, 29}}, {{157, 74}, {140, 71}, {121, 70}, {105, 65}, {86, 55}, {69, 52}, {52, 43}, {32, 37}}, {{158, 100}, {141, 100}, {123, 95}, {105, 90}, {88, 78}, {69, 72}, {51, 57}, {33, 46}}, {{160, 143}, {140, 146}, {123, 146}, {105, 145}, {86, 136}, {70, 121}, {51, 97}, {34, 60}}}
Could someone please help me with the function that has to be used for solving this problem in MATLAB ?
0 Kommentare
Akzeptierte Antwort
Torsten
am 4 Jul. 2022
Bearbeitet: Torsten
am 4 Jul. 2022
Differentiating with respect to a, setting the derivative to 0 and solving for "a" gives
a = sum_i (f_i*g_i) / sum_i (f_i^2)
I leave it to you to insert the data points.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Interpolation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!