Fitting of multiple data sets with different lengths

15 Ansichten (letzte 30 Tage)
zhi liu
zhi liu am 20 Feb. 2018
Bearbeitet: the cyclist am 21 Feb. 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 ];

Akzeptierte Antwort

the cyclist
the cyclist am 21 Feb. 2018
Bearbeitet: the cyclist am 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 Kommentare
zhi liu
zhi liu am 21 Feb. 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 am 21 Feb. 2018
Bearbeitet: the cyclist am 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).

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Statistics and Machine Learning Toolbox 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