David McGee
2010-05-27 04:16:58 UTC
-->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
-->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