フィルターのクリア

"Empty sym" when solving a system of linear equations with different conditions

2 ビュー (過去 30 日間)
Richard
Richard 2024 年 5 月 15 日
編集済み: Torsten 2024 年 5 月 16 日
I have a system of linear equations with several conditions describing a kinematic analysis of an automatic gearbox. The system is the following:
where all values Z are positive.
Then the following conditions are applied
These conditions are permanently valid. Thereafter other conditions are going to be applied according to the engaged gear. For example in fifth gear, the further conditions are:
The aim is to obtain a symblic equation expression consisting of parameters Z, which defines the gear ratio between the output and input. The gear ratio in 5th gear is for instance
Mathematically the system has 12 unknonws and 11 equations, so it gives exactly the expression for the ratio between the output and input as a function of parameters Z.
The transmission has a total of 10 gears, so it would be pretty difficult to make all manually.
My idea was creating a code as follows:
syms Z1A Z2A Z3A Z4A Z1B Z2B Z3B Z4B positive
syms w1A w2A w3A w4A ...
w1B w2B w3B w4B ...
w1C w2C w3C w4C i
% System of equations
eqn1 = w1A*Z1A + w1B*Z1B == w1C*(Z1A+Z1B);
eqn2 = w2A*Z2A + w2B*Z2B == w2C*(Z2A+Z2B);
eqn3 = w3A*Z3A + w3B*Z3B == w3C*(Z3A+Z3B);
eqn4 = w4A*Z4A + w4B*Z4B == w4C*(Z4A+Z4B);
% Permanently valid conditions
cond1 = w2A == w1A;
cond2 = w2B == w3A;
cond3 = w1C == w4B;
cond4 = w3B == w4A;
% Fifth gear analysis example
w1B = 0;
cond_gear5_1 = w4C == w3C;
cond_gear5_2 = w2B == w4A;
ratio = i == w4C/w4A;
Sol = solve([eqn1 eqn2 eqn3 eqn4 ...
cond1 cond2 cond3 cond4 ...
cond_gear5_1 cond_gear5_2 ratio], i)
Sol = Empty sym: 0-by-1
I was probably too optimistic about getting the desired expression from Matlab. The problem is that I don't know how to make it work.
Each advice is appreciated.
UPDATE: I tried a different approach using consecutive substitutions. I implemented the permanently valid conditions already in the system of equations.
syms Z1A Z2A Z3A Z4A Z1B Z2B Z3B Z4B positive
syms w1A w2A w3A w4A ...
w1B w2B w3B w4B ...
w1C w2C w3C w4C i
% System of equations
eqn1 = w2A*Z1A + w1B*Z1B == w4B*(Z1A+Z1B);
eqn2 = w2A*Z2A + w3A*Z2B == w2C*(Z2A+Z2B);
eqn3 = w3A*Z3A + w4A*Z3B == w3C*(Z3A+Z3B);
eqn4 = w4A*Z4A + w4B*Z4B == w4C*(Z4A+Z4B);
% Fifth gear analysis example
eqn1 = subs(eqn1,w1B,0);
eqn2 = subs(eqn2,w2C,w4A);
eqn3 = subs(eqn3,w3C,w4C);
Sol_w2A = solve(eqn1, w2A); eqn2 = subs(eqn2,w2A,Sol_w2A);
Sol_w4B = solve(eqn2, w4B); eqn4 = subs(eqn4,w4B,Sol_w4B);
Sol_w3A = solve(eqn3, w3A); eqn4 = subs(eqn4,w3A,Sol_w3A);
eqn4 = subs(eqn4,w4C,i*w4A);
Sol_i = solve(eqn4, i); Sol_i = expand(Sol_i); Sol_i = simplify(Sol_i);
pretty(Sol_i)
Z1A Z2A Z3A Z4A + Z1A Z2A Z3A Z4B + Z2A Z3A Z4A Z1B + Z1A Z3A Z2B Z4B + Z1A Z2B Z3B Z4B --------------------------------------------------------------------------------------------------------- Z1A Z2A Z3A Z4A + Z1A Z2A Z3A Z4B + Z2A Z3A Z4A Z1B + Z1A Z3A Z2B Z4B + Z2A Z3A Z1B Z4B + Z1A Z2B Z3B Z4B

回答 (2 件)

Walter Roberson
Walter Roberson 2024 年 5 月 15 日
編集済み: Walter Roberson 2024 年 5 月 15 日
Sol = solve([eqn1 eqn2 eqn3 eqn4 ...
cond1 cond2 cond3 cond4 ...
cond_gear5_1 cond_gear5_2 ratio], i)
That is a request to solve 11 simultaneous equations with respect to the scalar i . There is no scalar i that solves all of the equations simultaneously.
Your discussion refers to suggesting that you want
syms i [1 5]
Mathematically the system has 12 unknonws
You need to specify the 11 variables to solve for
  1 件のコメント
Richard
Richard 2024 年 5 月 15 日
I added an update. The index in scalar means that the gear ratio refers to the speed 5 of the gearbox. The other gear ratios will have other conditions. For example will have , and , so I am looking for a general algorithm, which solves the system according to the conditions given by the gear ratio engaged.

サインインしてコメントする。


Torsten
Torsten 2024 年 5 月 15 日
編集済み: Torsten 2024 年 5 月 16 日
Your system only has a (nontrivial) solution if i = 1. In this case, the solution is given as below.
syms Z1A Z2A Z3A Z4A Z1B Z2B Z3B Z4B positive
syms w1A w2A w3A w4A ...
w1B w2B w3B w4B ...
w1C w2C w3C w4C i
% System of equations
eqn1 = w2A*Z1A + w1B*Z1B == w4B*(Z1A+Z1B);
eqn2 = w2A*Z2A + w3A*Z2B == w2C*(Z2A+Z2B);
eqn3 = w3A*Z3A + w4A*Z3B == w3C*(Z3A+Z3B);
eqn4 = w4A*Z4A + w4B*Z4B == w4C*(Z4A+Z4B);
% Permanently valid conditions
cond1 = w2A == w1A;
cond2 = w2B == w3A;
cond3 = w1C == w4B;
cond4 = w3B == w4A;
% Fifth gear analysis example
cond_gear5_0 = w1B == 0;
cond_gear5_1 = w4C == w3C;
cond_gear5_2 = w2B == w4A;
ratio = i*w4A == w4C;
[A,b] = equationsToMatrix([eqn1,eqn2,eqn3,eqn4,cond1,cond2,cond3,cond4,cond_gear5_0,cond_gear5_1,cond_gear5_2,ratio],...
[w1A w2A w3A w4A w1B w2B w3B w4B w1C w2C w3C w4C])
A = 
b = 
simplify(det(A))
ans = 
A = subs(A,i,1)
A = 
v = null(A)
v = 
simplify(A*v)
ans = 

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by