• Scilab - check or define function %s_2_s for overloading

    From kvasan166@gmail.com@21:1/5 to Eric on Thu Jun 20 22:54:25 2019
    On Friday, May 28, 2010 at 1:00:16 PM UTC+5:30, Eric wrote:
    On May 27, 6:16 am, David McGee <mcgee.dav...@gmail.com> wrote:
    clear

    worksheet = readxls('file.xls');

    worksheet2 = worksheet(2);

    SampNum = worksheet2.value(:,1);

    Time = worksheet2.value(:,2);

    Speed = worksheet2.value(:,3);

    Accel = worksheet2.value(:,4);

    Distance = worksheet2.value(:,5);

    j=size(Speed);                    //Defines the size of the Table
    of data [Rows, Columns)



    Poly6=polyfit(Time,Speed,6);      //Line of best fit

    Poly1(1)=Poly6(7);

    Poly1(2)=Poly6(6);

    Poly1(3)=Poly6(5);

    Poly1(4)=Poly6(4);

    Poly1(5)=Poly6(3);

    Poly1(6)=Poly6(2);

    Poly1(7)=Poly6(1);

    r=roots(Poly1) ;                  //Finds roots of 6th Degree Polynomial

    g=1;

    n=1;



    [maxspeed,maxloc] = max(Speed);



    for(i=0:.25:Speed(maxloc))        //Loop that is going to find all roots from 0 to the max speed
     Poly1(7)=Poly1(7)-.25;             //of the stalker run
     n=1;
     c=Poly1;
     rootchange = roots(c);
     for m = 1:1:6
      if(rootchange(m)> 0) && (rootchange(m)<(Time(j(1)))) then
         if(rootchange(m) == (rootchange(m))) then            //Puts
    the real roots between 0 and
         roots6a(n,g) = rootchange(m);                      //the max
    distance in a vector
         n=n+1;
        end
      end
     end
     g=g+1;
    end
                                                                                                                     !--
    error 144
    Undefined operation for the given operands.

    check or define function %s_2_s for overloading.

    I am trying to transfer code from matlab to scilab and running into
    some issues, i am getting a "check or define function %s_2_s for overloading" error and i think the cause is that scilab can't handle
    the complex roots correctly when i processing through
    "if(rootchange(m)> 0) && (rootchange(m)<(Time(j(1))))".

    I am trying to find two real roots between 0 and the max time. I
    believe i need to add another loop to pull out only my real roots from
    the 6 and then allow those to process. I am running into issues of how
    to enter this into my code, any ideas?

    Thanks in advance,
    David

    Hi.

    The problem is that Scilab cannot compare a complex (root in your
    case) to 0. Neither can I!

    So, if you have searching for real positive roots then you have to
    perform the operation in 2 steps :
    if isreal(rootchange(m)) then
    if real(rootchange(m))>0 then
    ...

    Éric.


    Thank you Eric,
    For sharing the information. I too had same error. But now I got it cleared.

    Thank you..!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)