Fitting of multiple data sets with different lengths

15 次查看(过去 30 天)
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 ];

采纳的回答

the cyclist
the cyclist 2018-2-21
编辑:the cyclist 2018-2-21
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 个评论
zhi liu
zhi liu 2018-2-21
Thank you so much! I understand how to fit a single data set using self-defined function but being wondering on how can I fit a multiple sets. Do you mean just need to concatenate is fine? In this case the columns are not in sequence.
the cyclist
the cyclist 2018-2-21
编辑:the cyclist 2018-2-21
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).

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by