Print

Print


> I have a question concerning the least squares fit performed in the 
> spm_realign.m by the parameter dectection loop:
> 
> The least squares solution for [-dXdQ Y] * q0 = X is here calculated by
> 
> 	q0 =[-dXdQ Y]\X .
> 
> Wouldn't it be better to use
> 
> 	q0 = pinv( [-dXdQ Y] ) * X
> 
> instead, because this expression minimizes || [-dXdQ Y] * q0 - X ||, 
> whereas the acutally used expression generates the solution with the fewest 
> possible nonzero components ?

Providing that the matrix [-dXdQ Y] is not underdetermined, then the solutions
should be the same (apart from rounding errors).  According to the matlab
documentation on mldivide:

    If A is an M-by-N matrix with M < or > N and B is a column
    vector with M components, or a matrix with several such columns,
    then X = A\B is the solution in the least squares sense to the
    under- or overdetermined system of equations A*X = B.

The matrix [-dXdQ Y] may be underdetermined occasionally, but this is when
there is very little overlap between the images.  In cases like this, the
parameter estimates are so far from the ideal solution that the routine
will fail anyway.

Regards,
-John


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%