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);

 Accepted Answer

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 Comments

Nick Blom
Nick Blom on 8 Apr 2021
Thank you for the response, and you are correct all the values to the right of each equation is a known value. So to fix this issue I need to look over my equations.
link3T and link4T are the problems. Both of those can be expressed in terms of the other equations.
Nick Blom
Nick Blom on 9 Apr 2021
Okay I got it now, thank you

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!