# Problem with solution seemingly simple linear system of equations [0x1 sym]

2 views (last 30 days)
Jan Tomaszewski on 16 Apr 2021
Commented: Jan Tomaszewski on 16 Apr 2021
Hi, I have a problem with solve linear system of equations. Every time I got a solution = 0x1 sym.Could anyone tell what's wrong with my code?
clear
close all
d=32; %mm - Srednica tłoka
p1=0.585; %N/mm^2
p2=0.4;
F1=p1*pi*d^2/4;%N sila nacisku
F2=p2*pi*d^2/4;%N sila nacisku
L=[230 200 180 160 140 120 100 80 60 40]';
x_p1=[2.7 2.5 2.4 2.3 2.2 2.1 2 1.9 1.8 1.7]';
M1=F1*[L]*1e-3;%Nm
M2=F2*[L]*1e-3;%Nm
digits(8)
syms x1 x2
eqns=[F1*x1+M1*x2==x_p1]
xx=solve(eqns,[x1 x2])

Stephan on 16 Apr 2021
rewriting the system to matrix shows that this system has no solution, due to inconsistence:
d=32; %mm - Srednica tłoka
p1=0.585; %N/mm^2
p2=0.4;
F1=p1*pi*d^2/4;%N sila nacisku
F2=p2*pi*d^2/4;%N sila nacisku
L=[230 200 180 160 140 120 100 80 60 40]';
x_p1=[2.7 2.5 2.4 2.3 2.2 2.1 2 1.9 1.8 1.7]';
M1=F1*L*1e-3;%Nm
M2=F2*L*1e-3;%Nm
digits(8)
syms x1 x2
eqns=F1*x1+M1*x2
A = equationsToMatrix(eqns)
sol = linsolve(A, x_p1)
gives:
A =
[ (3744*pi)/25, (21528*pi)/625]
[ (3744*pi)/25, (3744*pi)/125]
[ (3744*pi)/25, (16848*pi)/625]
[ (3744*pi)/25, (14976*pi)/625]
[ (3744*pi)/25, (13104*pi)/625]
[ (3744*pi)/25, (11232*pi)/625]
[ (3744*pi)/25, (1872*pi)/125]
[ (3744*pi)/25, (7488*pi)/625]
[ (3744*pi)/25, (5616*pi)/625]
[ (3744*pi)/25, (3744*pi)/625]
Warning: Solution does not exist because the system is inconsistent.
> In symengine
In sym/privBinaryOp (line 1030)
In sym/linsolve (line 63)
In Untitled (line 15)
sol =
Inf
Inf
Maybe some errors in the coefficients?
##### 1 CommentShowHide None
Jan Tomaszewski on 16 Apr 2021
Stephan, you have right, there is no exact solution. I made approximations using the function
x = lsqlin(C,d,A,b)
that determined the variables x1 x2.
Thanks for help.

R2020a

### Community Treasure Hunt

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

Start Hunting!