필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
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
Stephan 2021년 4월 16일
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
Jan Tomaszewski
Jan Tomaszewski 2021년 4월 16일
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.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by