Empty sym: 0-by-1

조회 수: 11 (최근 30일)
Nick Blom
Nick Blom 2021년 4월 8일
댓글: Nick Blom 2021년 4월 9일
This is my code where all values to the right of == are known and it keeps giving me the error saying empty sym: 0-by-1. Does anyone have any ideas why this is error keeps happening.
syms f12x f12y f32x f32y f43x f43y f14x f14y t12
link2x = f12x + f32x == m2*ag2x;
link2y = f12y + f32y == m2*ag2y;
link2T = -(r2/2)*sind(theta2)*f12x + (r2/2)*cosd(theta2)*f12y ...
- (r2/2)*sind(theta2)*f32x + (r2/2)*cosd(theta2)*f32y + t12 == Ig2*aAccel2;
link3x = -f32x + f43x == m3*ag3x;
link3y = -f32y + f43y == m3*ag3y;
link3T = (r3/2)*sind(theta3)*f32x - (r3/2)*cosd(theta3)*f32y - ...
(r3/2)*sind(theta3)*f43x + (r3/2)*cosd(theta3)*f43y == Ig3*aAccel3;
link4x = -f43x + f14x == m4*ag4x;
link4y = -f43y + f14y == m4*ag4y;
link4T = (r4/2)*sind(theta4)*f43x - (r4/2)*cosd(theta4)*f43y - ...
(r4/2)*sind(theta4)*f14x + (r4/2)*cosd(theta4)*f14y == Ig4*aAccel4 - T4;
[f12x,f12y,f32x,f32y,f43x,f43y,f14x,f14y,t12] = solve(link2x,link2y,link2T,...
link3x,link3y,link3T,link4x,link4y,link4T);

채택된 답변

Walter Roberson
Walter Roberson 2021년 4월 8일
There is no solution to those equations.
m2 = rand() * 10;
m3 = rand() * 10;
m4 = rand() * 10;
ag2x = randn() * 10;
ag3x = randn() * 10;
ag4x = randn() * 10;
ag2y = randn() * 10;
ag3y = randn() * 10;
ag4y = randn() * 10;
Ig2 = rand() * 10;
Ig3 = rand() * 10;
Ig4 = rand() * 10;
aAccel2 = randn() * 10;
aAccel3 = randn() * 10;
aAccel4 = randn() * 10;
T4 = rand() * 10;
r2 = rand() * 10;
r3 = rand() * 10;
r4 = rand() * 10;
theta2 = rand() * 360;
theta3 = rand() * 360;
theta4 = rand() * 360;
syms f12x f12y f32x f32y f43x f43y f14x f14y t12
vars = [f12x f12y f32x f32y f43x f43y f14x f14y t12];
link2x = f12x + f32x == m2*ag2x;
link2y = f12y + f32y == m2*ag2y;
link2T = -(r2/2)*sind(theta2)*f12x + (r2/2)*cosd(theta2)*f12y ...
- (r2/2)*sind(theta2)*f32x + (r2/2)*cosd(theta2)*f32y + t12 == Ig2*aAccel2;
link3x = -f32x + f43x == m3*ag3x;
link3y = -f32y + f43y == m3*ag3y;
link3T = (r3/2)*sind(theta3)*f32x - (r3/2)*cosd(theta3)*f32y - ...
(r3/2)*sind(theta3)*f43x + (r3/2)*cosd(theta3)*f43y == Ig3*aAccel3;
link4x = -f43x + f14x == m4*ag4x;
link4y = -f43y + f14y == m4*ag4y;
link4T = (r4/2)*sind(theta4)*f43x - (r4/2)*cosd(theta4)*f43y - ...
(r4/2)*sind(theta4)*f14x + (r4/2)*cosd(theta4)*f14y == Ig4*aAccel4 - T4;
eqn = [link2x,link2y,link2T,link3x,link3y,link3T,link4x,link4y,link4T] .'
eqn = 
[A,B] = equationsToMatrix(eqn, vars)
A = 
B = 
rank(A)
ans = 7
A\B
Warning: Solution does not exist because the system is inconsistent.
ans = 
  댓글 수: 3
Walter Roberson
Walter Roberson 2021년 4월 9일
link3T and link4T are the problems. Both of those can be expressed in terms of the other equations.
Nick Blom
Nick Blom 2021년 4월 9일
Okay I got it now, thank you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by