Fitting of multiple data sets with different lengths
15 views (last 30 days)
Show older comments
Hello all,
I want to fit several sets of data with varying lengths to a single curve. They are independent repeated sets achieved from experiment shown by the graph (The dashed and the solid lines make no difference). To address the key of my question, only 3 sets are given as following. Could you show me a thought please? Thank you all.
X1=[0 ,20 ,40 ,54.78];
Y1=[5.31,5.12,2.98 ,0 ];
X2=[0 ,20 ,40 ,60 ,69.66];
Y2=[6.29,6.15,4.90,1.68 ,0 ];
X3=[0 ,20 ,40 ,60 ,80 ,84.52];
Y3=[6.39,6.30,5.50 ,3.30,0.38 ,0 ];
0 Comments
Accepted Answer
the cyclist
on 21 Feb 2018
Edited: the cyclist
on 21 Feb 2018
First, combine all the X's and Y's into a single dataset:
X = [X1, X2, ... XN]'; % Transpose to a column vector, because fitting functions expect columns
Y = [Y1, Y2, ... YN]'; % Transpose to a column vector, because fitting functions expect columns
Then, use the fitting function of your choice on X and Y. You don't say what kind of functional form you want to fit, so it is not possible to state which function you need.
If you have the Statistics and Machine Learning Toolbox, then take a look at your options on this documentation page.
2 Comments
the cyclist
on 21 Feb 2018
Edited: the cyclist
on 21 Feb 2018
Your description suggests that the fact that the data were collected from different experiments is not an important variable. I therefore assume that that distinction can be ignored, which is why you can concatenate the data (as if they were from a single experiment). You'll still need to ensure that each (X,Y) pair is properly accounted for (i.e. appears in the same row of their respective vectors).
More Answers (0)
See Also
Categories
Find more on Statistics and Machine Learning Toolbox 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!