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!