Prev: image processing
Next: Performance issues in processing
From: rak rakshit on 16 May 2010 15:58 Hi All, I have a set of x and y and known standard deviations for each y. I need to fit, y=m*x+c along with the standard deviations. On the other hand, I need to use weighted linear fit with different standard errors for each y. I need help in solving it. Thanks in advance.
From: Bruno Luong on 16 May 2010 16:36 "rak rakshit" <kishaloi(a)yahoo.co.in> wrote in message <hspiob$7uk$1(a)fred.mathworks.com>... > Hi All, > > I have a set of x and y and known standard deviations for each y. I need to fit, y=m*x+c along with the standard deviations. On the other hand, I need to use weighted linear fit with different standard errors for each y. I need help in solving it. > % Data x = 1:10; S = x/10; % standard deviation y = 2*x + 1; y = y + S.*randn(size(y)); % Fit without Weight P = M\y(:) % Using Weight X = diag(1./S); P = (X*M)\(X*y(:)) Bruno
From: rak rakshit on 16 May 2010 17:00 "Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hspkvk$9k0$1(a)fred.mathworks.com>... > "rak rakshit" <kishaloi(a)yahoo.co.in> wrote in message <hspiob$7uk$1(a)fred.mathworks.com>... > > Hi All, > > > > I have a set of x and y and known standard deviations for each y. I need to fit, y=m*x+c along with the standard deviations. On the other hand, I need to use weighted linear fit with different standard errors for each y. I need help in solving it. > > > > % Data > x = 1:10; > S = x/10; % standard deviation > y = 2*x + 1; > y = y + S.*randn(size(y)); > > % Fit without Weight > P = M\y(:) > > % Using Weight > X = diag(1./S); > P = (X*M)\(X*y(:)) > > Bruno Is M the slope of the equation?
From: Bruno Luong on 16 May 2010 17:07 > Is M the slope of the equation? M is a matrix - clearly it can't be a slope. The slope is P(1). Bruno
From: rak rakshit on 16 May 2010 17:12
I am sorry, but how do I get M? "Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hspmpn$b9q$1(a)fred.mathworks.com>... > > > Is M the slope of the equation? > > M is a matrix - clearly it can't be a slope. The slope is P(1). > > Bruno |