[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Nonconformant \ behaviour
From: |
Johan Kullstam |
Subject: |
Re: Nonconformant \ behaviour |
Date: |
29 Jan 2001 08:44:19 -0500 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
"Richard Gould" <address@hidden> writes:
> In matlab, the command sequence:
>
> A=[1,2,3,4];
> b=[1];
> x=A\b
>
> gives x=[0;0;0;0.2500]
>
> Whilst in octave, this produces the message:
>
> "error: operator \: nonconformant arguments (op1 is 1x4, op2 is 1x1)"
> Is there a way of working around this apparent discrepency?
try
x = pinv(A)*b;
but this gives
jk:4> pinv(A)*x
ans =
0.033333
0.066667
0.100000
0.133333
i am not sure what you expect A\b to do. it's underdetermined so i
guess matlab just picks a working solution. you could just take
a/some column(s) of A and divide those into b. this gives you a
partial x. fill with zeros to taste.
--
J o h a n K u l l s t a m
address@hidden
Don't Fear the Penguin!
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------