curve fit on two Y variables with unequal X?

2 Ansichten (letzte 30 Tage)
Arash Dabir
Arash Dabir am 22 Mär. 2021
Kommentiert: William Rose am 24 Mär. 2021
I have two sets of data: {X1, Y1}, {X2, Y2}. both sets contain the same number of samples, however X1 and X2 values are not the same. I am trying to do a curve fit for Y2 vs. Y1. What's the best way?
  4 Kommentare
Mathieu NOE
Mathieu NOE am 24 Mär. 2021
hello
can you share the data and the code so far ?
Arash Dabir
Arash Dabir am 24 Mär. 2021
I cannot- beacause of proprietary reasons. just think of it as a purely mathematical problem.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Star Strider
Star Strider am 24 Mär. 2021
To clarify, the lengths of the ‘X1’ and ‘Y1’ data set are the same as each other, and the lengths of the ‘X2’ and ‘Y2’ data set are the same as each other, however the two data sets have differrent lenghts?
If so, and the objective is to get one set of fitting parameters for both sets, just vertically concatenate them and then fit them to the same model, whatever that model is.
So assuming they are all vectors:
Xv = [X1(:); X2(:)];
Yv = [Y1(:); Y2(:)];
then do the regression on ‘Xv’ and ‘Yv’, whether it is linear or non-linear. If either (or both) the ‘X’ or ‘Y’ values are matrices, this proceeds similarly, however the code changes to accommodate the matrices. The parameter estimation routines, and models, whatever they are, are insensitive to the orders of the data so long as the independent and dependent variables’ relation to each other does not change (so ‘X(k,:)’ and ‘Y(k,:)’ are always together in the vertically-concatenated matrix for every ‘k’).
Then plot each data set individually using each ‘X’ and ‘Y’, and fit each with the same set of parameters.
I recently did something similar with differential equations: Parameter estimation for a system of differential equations with multiple time spans .
  1 Kommentar
William Rose
William Rose am 24 Mär. 2021
The method recommended by @Star Strider is very good, if you want to make a model of the relationship between X and Y. I was under the impression that Y1 and Y2 were different variables. For example, X might be time, and Y1 is pressure, and Y2 is temperature, or whatever.
Readers understand that you cannot reveal the details for proprietary reasons. It would help us if you create a specific version of your problem, with names of variables and simulated data and an example model equation, so that readers have a better understanding of what you are trying to do.

Melden Sie sich an, um zu kommentieren.


William Rose
William Rose am 24 Mär. 2021
I would intrpolate (X2,Y2) to estimate Y2 at the values X1, for the values of X1 that lie within the bounds of X2. Then I would fit measured Y1 versus Y2 interpolated to X1.
Then I would repeat the process but reversing the 1's and 2's. In other words, I would fit measured Y2 versus Y1 interpolated to X2.
Then I would compared the model parameter estimates from the first and second methods. If they are close, then I am confident in my results.
I would experiment with interpolation methods, such as 'linear', 'spline', 'pchip'.

Kategorien

Mehr zu Linear and Nonlinear Regression 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!

Translated by