[scilab-Users] Difference in calculations between Matlab and Scilab

Sébastien Bihorel pomchip at free.fr
Wed Nov 11 19:17:56 CET 2009


Scilab got me there :D Thanks for the tip... I actually found a fix using
ones(1,size(X,2) instead of 1, but, now, realize why this fixed the problem.

On Wed, Nov 11, 2009 at 10:59 AM, Yann Collette <yann.collette at scilab.org>wrote:

> Hello,
>
> Classical mistake:
>
> Try
>
> (1)./X
>
> the . under matlab has not the same priority as the scilab one.
>
> YC
>
> Sébastien Bihorel a écrit :
>
>  Hi
>>
>> I would be interested knowing why Scilab (version beta 5.2) and Matlab
>> (7.6.0) do not provide the same results for a '1/x' calculation (with x
>> being a matrix of real numbers), and how to reproduce the results of Matlab
>> in Scilab for this particular case.
>>
>> Thank you
>>
>> Sebastien
>>
>> %%%%%%Matlab
>>
>> >> X=1:5
>>
>> X =
>>
>>     1     2     3     4     5
>>
>> >> 1./X
>>
>> ans =
>>
>>    1.0000    0.5000    0.3333    0.2500    0.2000
>>
>>
>> /////////////// Scilab
>>
>> -->X=1:5
>>  X  =
>>      1.    2.    3.    4.    5.  -->1./X
>>  ans  =
>>      0.0181818    0.0363636    0.0545455    0.0727273    0.0909091
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20091111/2e3f7e5b/attachment.htm>


More information about the users mailing list