From: TideMan on
On May 17, 9:07 am, "Bruno Luong" <b.lu...(a)fogale.findmycountry>
wrote:
> > Is M the slope of the equation?
>
> M is a matrix - clearly it can't be a slope. The slope is P(1).
>
> Bruno

Bruno

I think you forgot to define M
M=[x' ones(length(x),1)];

From: Bruno Luong on
"rak rakshit" <kishaloi(a)yahoo.co.in> wrote in message <hspn33$11b$1(a)fred.mathworks.com>...
> I am sorry, but how do I get M?
>

Oops sorry, I confirmed

M=[x(:) ones(length(x),1)]

Thank you Tideman.

Bruno
From: rak rakshit on
Thank you very much
"Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hspneb$no8$1(a)fred.mathworks.com>...
> "rak rakshit" <kishaloi(a)yahoo.co.in> wrote in message <hspn33$11b$1(a)fred.mathworks.com>...
> > I am sorry, but how do I get M?
> >
>
> Oops sorry, I confirmed
>
> M=[x(:) ones(length(x),1)]
>
> Thank you Tideman.
>
> Bruno
From: Peter Perkins on
On 5/16/2010 4:36 PM, Bruno Luong wrote:
> % Using Weight
> X = diag(1./S);
> P = (X*M)\(X*y(:))

LSCOV is perhaps a somewhat simpler alternative using the same M, S
(S.^2, actually), and y:

>> help lscov
LSCOV Least squares with known covariance.
[snip]
X = LSCOV(A,B,W), where W is a vector length M of real positive weights,
returns the weighted least squares solution to the linear system A*X =
B, i.e., X minimizes (B - A*X)'*diag(W)*(B - A*X). W typically
contains either counts or inverse variances.