fitting with y and x dependent variables
Show older comments
I have 2 columns of universal data X and Y. I can plot an universal Y as a function of X.
Now, X = x / Xc. And Y = y / Yc.
x and y are my experimental data.
Xc and Yc are the fitting parameters that I need to retrieve. In other word, I need to find Xc and Yc in order to minimize the difference between the Y versus X (that I know) and the y*Yc versus x*Xc
How can I do that ?
14 Comments
Torsten
on 13 Jun 2022
So you want to minimize
sum_i [(Xi*Xc - xi).^2 + (Yi*Yc - yi).^2]
in which Xc and Yc are the fitting parameters and X, Y, x, y are given vectors ?
Torsten
on 13 Jun 2022
@laurent jalabert comment moved here:
Yes, what you wrote is the minimum vector length between data and target array of normalized data.
Notice that x and y vectors have different length compared to X and Y.
Torsten
on 13 Jun 2022
Notice that x and y vectors have different length compared to X and Y.
Why ?
I thought X = x / Xc and Y = y / Yc where Xc and Yc are scalars. Thus x and X as well as y and Y should have the same length.
Torsten
on 13 Jun 2022
@laurent jalabert comment moved here:
first of all, thank you so much to take your time to answer my problem.
You are right, they should have same length. But in the real life of experiments, x and y have less available data point, compared to what computers can output from complicated model. That is why x,y have not same dimension than X and Y.
Torsten
on 13 Jun 2022
Please use the "comment" button instead of the "answer" button when you want to make comments.
That is why x,y have not same dimension than X and Y.
Then you should supply only those X and Y data that correspond to the x and y experimental data.
E.g. if x and y were time-dependent experimental data measured at times t, then you also should only use those X and Y data at the times t of the experimental measurements for the fitting process.
Is this possible ?
Image Analyst
on 13 Jun 2022
@laurent jalabert If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
laurent jalabert
on 13 Jun 2022
laurent jalabert
on 13 Jun 2022
Edited: laurent jalabert
on 13 Jun 2022
laurent jalabert
on 13 Jun 2022
laurent jalabert
on 15 Jun 2022
Suppose you are given Xc and Yc.
Then you can calculate x/Xc and y/Yc.
Now with which X and Y value do you want to compare x/Xc and y/Yc in the optimization process ?
Taking the X that is nearest to x/Xc and the corresponding Y in the table of theory data to compare with y/Yc ?
Or taking the Y value that is nearest to y/Yc and the corresponding X in the table of theory data to compare with x/Xc ?
Or ...
laurent jalabert
on 15 Jun 2022
Edited: laurent jalabert
on 16 Jun 2022
Answers (0)
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!