I have a 'Matrix' (4x4) as following.
Matrix =
206.3088 9.4042 1.2780 0.9845
206.3099 4.6309 1.2050 0.9857
206.3559 9.4029 1.3192 1.0236
206.3573 4.6307 1.2421 1.0252
Now I need to do a multiple automated curve fitting between 'column 2' and 'column 3' data points. For a fitting procedure only adjacent values based on 'column 1' (time) should be selected. Also take an average for corresponding data in 'column 1' and 'column 4'.
For example in the given Matrix two curve fitting result can be achieved as following manually. Similarly, manually the corresponding average value for data points in 'column 1' and 'column 4' can be achieved.
Fit1=regstats(Matrix(1:2,3),Matrix(1:2,2),'linear','beta')
Fit2=regstats(Matrix(3:4,3),Matrix(3:4,2),'linear','beta')
C1 = mean (Matrix(1:2,1))
C2 = mean (Matrix(1:2,4))
The output should be like following for the 'Matrix'
Output =
206.3093 Fit1.beta(1) Fit1.beta(2) 0.9851
206.3566 Fit2.beta(1) Fit1.beta(2) 1.0244
Matrix(i,1)-Matrix(i+1,1)<0.01
? ā v.tralala