I don’t know the correct Scilab syntax

Asked

Viewed 9 times

0

I’m having a problem with Scilab, I migrated from Mathlab to Scilab to do an academic job but I’m having trouble with the following code:

c1x=input('centro da circunferencia 1 (x): ');
c1y=input('centro da circunferencia 1 (y): ');
c2x=input('centro da circunferencia 2 (x): ');
c2y=input('centro da circunferencia 2 (y): ');
r1=input('raio da circunferencia 1: ');
r2=input('raio da circunferencia 2: ');
d=sqrt((c1x-c2x)^2 + (c1y-c2y)^2);
if r1+r2 > d
 >>   symb x y
    eqn1 = x^2 - 2c1xx + c1x^2 + y^2 - 2c1yy + c1y^2 == r1^2;
    eqn2 = x^2 - 2c2xx + c2x^2 + y^2 - 2c2yy + c2y^2 == r2^2;
 >>   sol = solve([eqn1, eqn2], [x,y]);
    disp(['(' num2str(double(sol.x(1))) ', ' num2str(double(sol.y(1))) ')'])
    disp(['(' num2str(double(sol.x(2))) ', ' num2str(double(sol.y(2))) ')'])
elseif r1+r2 == d
  >>  symb x y
    eqn1 = x^2 - 2c1xx + c1x^2 + y^2 - 2c1yy + c1y^2 == r1^2;
    eqn2 = x^2 - 2c2xx + c2x^2 + y^2 - 2c2yy + c2y^2 == r2^2;
    sol = solve([eqn1, eqn2], [x,y]);
    disp(['(' num2str(double(sol.x(1))) ', ' num2str(double(sol.y(1))) ')'])
elseif r1+r2 < d
    disp(' não se interceptam')
end

Notice that in the lines where I put >> are the lines where I’m having trouble.

I know that in Scilab these Mathlab functions are written differently, but I can not find anywhere syntax related to these functions, some light?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.