[Scilab-users] linearly spaced vector

Samuel Gougeon sgougeon at free.fr
Sun Sep 6 15:34:01 CEST 2015


Hello,

you may use either:

x1 = (10:20)/100;
disp(x1(3)-0.12)

or
x_i = find(clean(x1-0.12)==0)

Samuel

Le 06/09/2015 14:57, fujimoto2005 a écrit :
> Hello,
>
> Let me explain why I want to get exact values.
> There is the following line in my script.
> x_i=find(x1==0.12)
> I suppose  it returns 3 but actually it fails to return 3 due to the error.
> So I modified that line into
> x_i=find(abs(x1-0.12)<10^-10)
> This work well only when x1 contains a single value near 0.12.
> But sometimes x1 contains 0.15 and 0.15000000002 depending on the way of
> generation of  x1.
> (The example  of the topic is a simple version of the more complex actual
> script.)
> In this situation 'find(abs(x1-0.12)<10^-10)' returns two values and my
> script doesn't  work.
>
> This is why I want to exact values.
>
> Can I get exact value by using  (MPScilab, MPAT, Xnum,...)?
>
> Best regards
>



More information about the users mailing list