[Scilab-users] array constructors

Samuel Gougeon sgougeon at free.fr
Tue Oct 2 21:12:44 CEST 2018


Le 02/10/2018 à 21:02, Heinz Nabielek a écrit :
> On 02.10.2018, at 20:31, Samuel Gougeon <sgougeon at free.fr> wrote:
>> Le 02/10/2018 à 18:37, Adelson Oliveira a écrit :
>>> Hi,
>>>
>>> In scilab 6.1, I've noticed that the array
>>>
>>> [8.9:0.2:9.9] does contain 8.9 and 9.9,
>>>
>>> but the array,
>>>
>>> [-5.1:0.2:5.1]
>>>
>>> does not contain the last element 5.1!
>>>
>>> find([-5.1:0.2:5.1] == 5.1) = []
>>>
>>> Why is that?
>>>
>>> Isn't it a bug?
>> We have
>> --> a = -5.1:0.2:5.1;
>> --> delta = a($)+0.2-5.1
>>   delta  =
>>     8.882D-16
>>
>> --> delta/5.1/%eps
>>   ans  =
>>     0.7843137
>>
>> So, computing the next value leads to 5.1 but with an excess within the epsilon machine.
>> Because of this excess, this last value is not included in the output set.
>>
>> I am wondering whether we could detect this kind of edge effects, and manage them more softly.
>>
>> Samuel
>
> UNDERSTOOD. But what is a safe way to plot histograms like histplot(a:b:c, X) where X is a one-dimensional array?

histplot(linspace(a, c, round((c-a)/b), X)
or
histplot(a:b:nearfloat("succ",c), X)




More information about the users mailing list