Fit a vector to matrix distribution

4 visualizaciones (últimos 30 días)
chris j
chris j el 11 de Mayo de 2020
Editada: Matt J el 11 de Mayo de 2020
Hello,
I have some eperimental data which have a relationship of the following form:
Where b and S are independent, and dependent variables, respectively. We define b, make some measurements, and record S with some uncertainty. i defined a custom fit function like so:
MonoExp_Func = fittype('f1.*exp(-D1.*x)','dependent',{'y'},'independent',{'x'},'coefficients',{'f1','D1'} );
and then applied some weighting and boundaries, like so:
Opt = fitoptions(MonoExp_Func);
Opt.StartPoint = [max(S),1e-5];
Opt.Lower=[LBound_f,LBound_D];Opt1.Upper=[UBound_f,UBound_D];
Opt.TolFun =1e-10;Opt1.TolX =1e-10;
Opt.Weights=1./W;
Where W was defined by measurement errors. I then fit this using:
Output = fit(Input_b, Input_S, MonoExp_Func, Opt1);
this worked fine.
However, we've since run an experiment that requires b to be a distribution of values, rather than a single point. So in my data, b goes from being a 1x18 vector, to a 8000x18 matrix. I'd now like to perform my weighted fit over this distribution of b to arrive at a fitted distribution of D1 & f1. I could just loop over the above, but I'm guessing there's a better way using matrices which would be more efficient? Can I just plug my new matrix into this and expect a distribution of values out for f1 and D1?
Thanks for your advice!

Respuestas (1)

Matt J
Matt J el 11 de Mayo de 2020
Editada: Matt J el 11 de Mayo de 2020
Can I just plug my new matrix into this and expect a distribution of values out for f1 and D1?
I assume you already tried this and discovered the answer already.
I could just loop over the above, but I'm guessing there's a better way using matrices which would be more efficient?
If the solutions f1,D1 vary gradually across the 8000 data sets, a loop could be very advantageous. You could use the solution of the previous fit as the start point for the next fit, and thus have only an incremental number of iterations to do for every subsequent fit.

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by