Search code examples
octavedata-analysis

Multivariate curve fit to experimental data


Recently I have approached new challenge that I have difficulties to work around. I have number of curves describing material behaviour during plastic forming and would like to place the data into elegant power law equation. The material is strain rate sensitive so I have few curves for various strain rates. The curves are in form of stress-strain curves. In language of mathematics:

f(B,C,x,y)=B^x*C^y

Where:

B = Strain,
C = Strain rate,
x = Strain coefficient,
y = Strain rate coefficient.

I have number of curves describing f(B) for various values of C.

Everything I have tried up till now is regarding linear functions or single independent variable.

I have also thought about simple function taking possible minimum and maximum values of x and y, creating matrix of the values with 100 elements each, then calculate the function for the first combination and standard deviation. After that, iteratively go from the combination to the combination and compare the standard deviations. Select the combination with the lowest deviation as a solution.

Another possibility would be to use fminunc or fminsearch but I do not know how to put the various curves as a starting point.

Can you assist me in writing the code finding x and y?

I can provide the curves if needed. All my numbers are natural.

Thank you


Solution

  • The most suitable solution for me is use of nlinfit. Exaple of algorithm:

    betaWithoutNoise = [80;0.3;0.1]; # True values of our parameters
    x=[0:0.1:1];
    x21(1:11)=0.01;
    x22(1:11)=0.1;
    xmatrix=[[x;x21],[x;x22]];
    realValues=betaWithoutNoise(1)*(xmatrix(1,:).^betaWithoutNoise(2)).*(xmatrix(2,:).^betaWithoutNoise(3))
    
    #adding noise to the function values
    noise=rand(size(realValues))-0.5;
    noisyValues=realValues+noise;
    
    #application of function model
    modelfun=@(b,xmatrix) (b(1)*(xmatrix(1,:).^(b(2))).*(xmatrix(2,:).^b(3)));
    beta0=[70,0.1,0.3];
    [beta,R,J,covb,mse]=nlinfit(xmatrix,noisyValues,modelfun,beta0);
    

    Thanks everybody for interest and assistance.