we want to plot a fit g and the corresponding 95% confidence bound. which command will let us do this? in matlab

Assuming you have the fit object g, you can use the plot method of the object along with the confint function to plot the fit and its corresponding 95% confidence intervals as follows:

main.m
% Get the confidence intervals for the fit
ci = confint(g, 0.95);

% Plot the fit and its confidence bounds
plot(g, 'b'); % Plot the fit curve in blue
hold on;
plot(ci(:,1), 'r--'); % Plot the lower confidence bound in red dashed line
plot(ci(:,2), 'r--'); % Plot the upper confidence bound in red dashed line
hold off;
320 chars
10 lines

This will plot the fit curve in blue and its corresponding 95% confidence bounds in red dashed line. Note that you can replace 0.95 with any desired confidence level (e.g., 0.99 for 99% confidence interval).

related categories

gistlibby LogSnag