# How To Curve Fitting In Respect To Other Curves & Calculate Shift And Compression Of Curve

5 views (last 30 days)
Jan Sander on 2 Nov 2020
Answered: Swetha Polemoni on 5 Nov 2020
Hi everybody,
i need a a little help since im stuck since weeks..
I need to fit -lets say- Curve C to Curve D. Curve D is fix, Curve C is calculated from Curve B - Curve A. Curve A and B can be shifted and can be compressed, thus Curve C is shifted and compressed. Curve A and B can be compressed and shifted independently and in my work have more elements than Curve C. The shift and compression of Curve A shall be calculated automatically. (Parameters of shift and compression can be set manually for Curve B)
How do i fit Curve C to Curve D in respect to Curve A AND calculate the shift and compression from Curve C to Curve D, or better directly the shift and compression of Curve A?
i can use lsqr with Curve_C * x = Curve_D, but this happends in no relation to Curve A and Curve B.
i use
x_shift = -trapz(y,x_C-x_D)/abs(ylims_2-ylims_1) %ylim calculate min and max y of Curve C and D
but i neglect the compression. Right now, the compression can be manually set as an input, but thus this problem can be solved directly in matlab, i want to do that for my thesis.
The big problem i see is that Curve C change its look when f.e. only Curve A is shifted. Thus it is difficult to fit the Curve C directly to Curve D.
In the attachment you can see a png file of my problem and example data.

Swetha Polemoni on 5 Nov 2020
Hi,
It is my understanding that you want to find relationship between your data sets. You may find 'lsqcurvefit" useful. You may have to experiment with combinations of curves A and B to get the result you wanted.
Refer to this for better understanding of using Isqcurvefit.