Fitting of multiple data sets with different lengths

15 visualizaciones (últimos 30 días)
zhi liu
zhi liu el 20 de Feb. de 2018
Editada: the cyclist el 21 de Feb. de 2018
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 ];

Respuesta aceptada

the cyclist
the cyclist el 21 de Feb. de 2018
Editada: the cyclist el 21 de Feb. de 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 comentarios
zhi liu
zhi liu el 21 de Feb. de 2018
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 el 21 de Feb. de 2018
Editada: the cyclist el 21 de Feb. de 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).

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by