From: Rafael on
Hi,

I was using polyfit to fit a line in my data. The nice thing about doing that is that I can actually get the 95% confidence interval as well when I use the polyconf function.

[p,S] = polyfit(x,y,1);
[Y,DELTA] = polyconf(p,x,S);

Now, I need to fit a line but force the intercept to be zero. My understanding is that polyfit cannot be used, and I heard in some of the posts that a simple equation like X\Y will give me the slope. polyconf needs the S variable calculated in polyfit to generate the confidence interval DELTA. Is there any way I can generate this same variable for the new linear fit X\Y or perhaps another way to compute confidence intervals in this case?

Thank you,
From: jrenfree on
On Nov 12, 2:04 pm, "Rafael " <roso...(a)gmail.com> wrote:
> Hi,
>
> I was using polyfit to fit a line in my data. The nice thing about doing that is that I can actually get the 95% confidence interval as well when I use the polyconf function.
>
> [p,S] = polyfit(x,y,1);
> [Y,DELTA] = polyconf(p,x,S);
>
> Now, I need to fit a line but force the intercept to be zero. My understanding is that polyfit cannot be used, and I heard in some of the posts that a simple equation like X\Y will give me the slope. polyconf needs the S variable calculated in polyfit to generate the confidence interval DELTA. Is there any way I can generate this same variable for the new linear fit X\Y or perhaps another way to compute confidence intervals in this case?
>
> Thank you,

http://www.mathworks.com/support/solutions/en/data/1-12BBUC/index.html?product=OP&solution=1-12BBUC