variance including in non linear fit
9 views (last 30 days)
Show older comments
Hello, I acquired a set of samples in a time window (100sample/sec), and I considered my final data as the mean of each measurement. I would like to fit (I used the lsqcurvefit matlab method, fitting an erfc function) a set of this measurement but I would like also to include the variance of each measurement in the fit....how could I do this?
In particular what I want to do is to fit an erfc function but the source of my data is a pawermeter which measures the power from a laser which is not so stable than each measurement presents a no-negligible variance.
0 Comments
Accepted Answer
Matt J
on 14 Oct 2020
Edited: Matt J
on 14 Oct 2020
If you mean you want to inversely weight by the variance, just pre-weight your ydata and your model function output,
x=lsqcurvefit(@(x,xdata) mdl(x,xdata)./weights, x0,xdata, ydata./weights,....)
2 Comments
Matt J
on 14 Oct 2020
fit=lsqcurvefit(@(p,x)(p(1)*(erfc(p(2)*(x-p(3))))+p(4))./weights,...
p0(i,:),distance(i,:),sample(i,:)./weights);
More Answers (0)
See Also
Categories
Find more on Descriptive Statistics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!