help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Differences between Octave and Matlab on division (/) operator with


From: Sebastian Schöps
Subject: Re: Differences between Octave and Matlab on division (/) operator with scalar and vector
Date: Sat, 25 Mar 2017 11:43:30 -0700 (PDT)

José Luis García Pallero wrote
> Hello:
> 
> Using this variables:
> 
> a = 2;
> b = [1 2 3];
> 
> For the operation a/b or 2/b or b/2 I obtain an error in Octave and
> Matlab due to wrong dimensions. But if I declare b as a vector column
> as b=[1 2 3]' I obtain in Octave:
> 
>>> a/b
> ans =
> 
>    0.14286   0.28571   0.42857
> 
> and in Matlab:
> 
>>> a/b
> 
> ans =
> 
>          0         0    0.6667
> 
> What is the reason of this difference? Why the operation is legal with
> b as column vector and illegal with row vector?
> 
> Thanks

Your problem does not have a unique solutions and Octave favors a different
(sparse) one. I had recently also problems with this issues, including the
different handling w.r.t. dimensions. You find the discussion here:
http://octave.1599824.n4.nabble.com/Bug-when-dividing-a-scalar-by-a-vector-td4681411.html

Sebastian



--
View this message in context: 
http://octave.1599824.n4.nabble.com/Differences-between-Octave-and-Matlab-on-division-operator-with-scalar-and-vector-tp4682615p4682616.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]