How can I fit curve to results of fit, including confidence interval
2 views (last 30 days)
Show older comments
I use "fit" on several sets of data and obtain the coefficients and confidence intervals for each set. For example
data = repmat((1:100)',1,100) + rand(100); % each column of "data" is a data set, which will be fitted to a straight line
coeffs = zeros(100,2); % to store the slope and intercept of each straight line
intervals = zeros(200,2); % to store the confidence intervals of the slopes and intercepts
for n = 1:100
linfit = fit((1:100)',data(:,n),'poly1'); % fit each column to a straight line
coeffs(n,:) = coeffvalues(linfit);
intervals(2*(n-1)+1:2*n,:) = confint(linfit);
end
Now, I want to fit the coefficients to a curve of choice, but the fit should account for the fact that the coefficients lie in the ranges given by "interval", rather than being the values stored in "coeffs". In other words, the above code gives 100 points, each with its own error bar. I want to fit a curve to these points including their error bars.
Any help appreciated. Thanks.
0 Comments
Answers (0)
See Also
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!