help-octave
[Top][All Lists]

## Re: Fitting multiple datasets to "partially" the same model (global fit

 From: JokerOne Subject: Re: Fitting multiple datasets to "partially" the same model (global fit with shared parameters) Date: Tue, 8 Dec 2015 03:51:13 -0800 (PST)

```Thanks everybody for your effort,

since I am not too common to the maths in these regression/optimization

Allen asks for some actual data. However, there is no "real" data, yet. For
my tests I just simulated some data in a simple way .

Here, I replaced the logaritmic term with a power term to underline that the
logaritmic term in indeed just an example function as Allen assumed
correctly. I do not know the function that will suit my final task, yet. I
am just checking the basic concept of the fitting routine with some example
functions.

# Create simulated data for fit using "shared" parameter

# Define Parameters to be fitted
a0   =    1;   #    offset poly 2nd order
a1   =    -3;  #    linear term poly 2nd order
a2   =    0.5; #    quadratic poly 2nd order

b1   =      1.5; #    power term : base

b2_list   =    [1:0.2:2]; #  list of exponential factors in power term

x    =    [1:10];     # Just some x-values

#    Create simulation data
c1   = 0;        # counter
for b2 = b2_list
c1++;     # increment counter
#    HERE: FOR SIMULATTION PURPOSE USE :
#    f(x)      =    b1^(-1*b2*x) * (a0+a1*x+a2*x^2)
y(:,c1)  =    b1.^(-1.*b2.*x).*(a0 + a1.*x +a2.*x.^2);
# Data is sorted in a matrix, could be handled otherwise if
reasonable/required...
endfor
# left for now : Add some noise to the data
# y  =    y +0.25.* randn(size(y));

#   plot data
figure(1)
plot(x,y,'o');

#    To solve:
#    Find parameters a0, a1, a2 and all parameters of b2_list using
#    a regression/fit routine that makes uses of fact, that a0,a1,a2 are
#    equal for all colums in y

I am very happy for any further advises and help.

--
View this message in context:
http://octave.1599824.n4.nabble.com/Fitting-multiple-datasets-to-partially-the-same-model-global-fit-with-shared-parameters-tp4673868p4673892.html
Sent from the Octave - General mailing list archive at Nabble.com.

```