MATLAB Answers

Empty sym: 0-by-1

92 views (last 30 days)
jirapat wongmitrtae
jirapat wongmitrtae on 30 Aug 2019
Answered: Mahesh Taparia on 19 Sep 2019
i used this code
F1 = [0 0 6];
F2 = [-1.7678 3.0619 3.5355];
F3 = [2 2 2.8284];
FR = F1 + F2 + F3;
r1 = [2 6 0];
r2 = [4 0 0];
M = cross(r1,F1)+cross(r2,F2);
uFR = FR/norm(FR);
syms x y
R1 = dot(M,uFR)*uFR + cross([x y 0],FR) == M
R2= norm([x y 0]/norm([x y 0])) == 1
sol = solve([R1,R2],[x,y]);
and when i wrote "sol.x" it returns "ans = Empty sym: 0-by-1"
could you check what i did wrong why it can't calculate x and y

  0 Comments

Sign in to comment.

Answers (1)

Mahesh Taparia
Mahesh Taparia on 19 Sep 2019
Hi,
As per your code, R1 consists of 3 equations with two unknowns. Also, there is no need of R2 as it will always give the value 1 for all x and y as numerator and denominator cancels each other. As per the solve command, the argument should be the equations followed by the variables. So, in your case it should be:
sol = solve([R1(1),R1(3)],[x,y]);
Or
sol = solve([R1(1),R1(2)],[x,y]);
and so on. Because R1 itself consists of 3 equations, it cannot be used directly.
Moreover, the solution will be more precise if ‘vpasolve’ will be used instead of solve command. This will show a very small variation in the value of x and y if it is executed with multiple equations due to more precision. Execute the following code and see the difference in result:
sol = vpasolve([R1(1),R1(3)],[x,y]);
sol = vpasolve([R1(1),R1(2)],[x,y]);

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags


Translated by