Empty sym: 0-by-1

조회 수: 16 (최근 30일)
jirapat wongmitrtae
jirapat wongmitrtae 2019년 8월 30일
답변: Mahesh Taparia 2019년 9월 19일
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

답변 (1개)

Mahesh Taparia
Mahesh Taparia 2019년 9월 19일
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]);

카테고리

Help CenterFile Exchange에서 Equation Solving에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by