How to solve nonlinear equation system with variable inputs?

조회 수: 14 (최근 30일)
Niklas
Niklas 2014년 10월 10일
답변: Walter Roberson 대략 4시간 전
Hello,
The function should be a method of a class (Obj, a planetary gear, if somebody is interested). I have 3 equations with 6 variables. 3 of the 6 variables are given and 3 are to be calculated. The thing is, that always 3 different variables are given and I have to calculate the rest:
The variables are: w(1), w(2), w(3), T(1), T(2) and T(3)
The given variables are always two of the w-array and one of the T-array.
eta0 and i0 are constants and thus already given
The equations are:
Obj.T(2)/Obj.T(1) == Obj.i0 * power(Obj.Eta0, Obj.T(1) * (Obj.w(1)-Obj.w(3))/abs(Obj.T(1) * (Obj.w(1)-Obj.w(3))))
Obj.T(1) + Obj.T(2) + Obj.T(3) = 0
Obj.w(1) - Obj.w(2) * Obj.i0 - Obj.w(3) * (1-Obj.i0) == 0
Does anyone know how to do this?
Thank you very much for the help!
  댓글 수: 1
Walter Roberson
Walter Roberson 2024년 12월 21일 1:49
Is power(A,B) the same as A.^B ? Or is power() intended here to be some kind of signal power calculation?

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

답변 (1개)

Walter Roberson
Walter Roberson 대략 4시간 전
syms Eta0 i0
syms w [1 3]
syms T [1 3]
eqn1 = T(2)/T(1) == i0 * power(Eta0, T(1) * (w(1)-w(3))/abs(T(1) * (w(1)-w(3)))); pretty(eqn1)
T1 (w1 - w3) -------------- T2 |T1 (w1 - w3)| -- == Eta0 i0 T1
eqn2 = T(1) + T(2) + T(3) == 0; pretty(eqn2)
T1 + T2 + T3 == 0
eqn3 = w(1) - w(2) * i0 - w(3) * (1-i0) == 0; pretty(eqn3)
w1 - i0 w2 + w3 (i0 - 1) == 0
eqns = [eqn1; eqn2; eqn3];
sol1 = solve(eqns, [w(1), T(1), T(2)])
Warning: Unable to find explicit solution. For options, see help.
sol1 = struct with fields:
w1: [0x1 sym] T1: [0x1 sym] T2: [0x1 sym]
sol2 = solve(eqns, [w(1), T(1), T(3)])
Warning: Unable to find explicit solution. For options, see help.
sol2 = struct with fields:
w1: [0x1 sym] T1: [0x1 sym] T3: [0x1 sym]
sol3 = solve(eqns, [w(1), T(2), T(3)]); pretty(sol3.w1); pretty(sol3.T2); pretty(sol3.T3)
w3 + i0 w2 - i0 w3 T1 (i0 w2 - i0 w3) -------------------- |T1 (i0 w2 - i0 w3)| Eta0 T1 i0 T1 (i0 w2 - i0 w3) -------------------- |T1 (i0 w2 - i0 w3)| - T1 - Eta0 T1 i0
sol4 = solve(eqns, [w(2), T(1), T(2)])
Warning: Unable to find explicit solution. For options, see help.
sol4 = struct with fields:
w2: [0x1 sym] T1: [0x1 sym] T2: [0x1 sym]
sol5 = solve(eqns, [w(2), T(1), T(3)])
Warning: Unable to find explicit solution. For options, see help.
sol5 = struct with fields:
w2: [0x1 sym] T1: [0x1 sym] T3: [0x1 sym]
sol6 = solve(eqns, [w(2), T(2), T(3)]); pretty(sol6.w2); pretty(sol6.T2); pretty(sol6.T3)
w1 - w3 + i0 w3 --------------- i0 T1 (w1 - w3) -------------- |T1 (w1 - w3)| Eta0 T1 i0 / T1 (w1 - w3) \ | -------------- | | |T1 (w1 - w3)| | -T1 \ Eta0 i0 + 1 /
sol7 = solve(eqns, [w(3), T(1), T(2)])
Warning: Unable to find explicit solution. For options, see help.
sol7 = struct with fields:
w3: [0x1 sym] T1: [0x1 sym] T2: [0x1 sym]
sol8 = solve(eqns, [w(3), T(1), T(3)])
Warning: Unable to find explicit solution. For options, see help.
sol8 = struct with fields:
w3: [0x1 sym] T1: [0x1 sym] T3: [0x1 sym]
sol9 = solve(eqns, [w(3), T(2), T(3)]); pretty(sol9.w3); pretty(sol9.T2); pretty(sol9.T3)
w1 - i0 w2 - ---------- i0 - 1 / w1 - i0 w2 \ T1 | w1 + ---------- | \ i0 - 1 / ---------------------------- | / w1 - i0 w2 \ | | T1 | w1 + ---------- | | | \ i0 - 1 / | Eta0 T1 i0 / w1 - i0 w2 \ T1 | w1 + ---------- | \ i0 - 1 / ---------------------------- | / w1 - i0 w2 \ | | T1 | w1 + ---------- | | | \ i0 - 1 / | - T1 - Eta0 T1 i0
We can see from the above that most of the forms do not have (reachable) symbolic solutions.
However, if we substitute in explicit numeric values for all of the variables, then we are able to get one numeric solution.
sample_eqns = subs(eqns, {w(2), w(3), T(3), Eta0, i0}, {2, 5, 7, 1/3, 11})
sample_eqns = 
sample_sol1 = solve(sample_eqns, [w(1), T(1), T(2)]); structfun(@double, sample_sol1, 'uniform', 0)
Warning: Unable to solve symbolically. Returning a numeric solution using vpasolve.
ans = struct with fields:
w1: -28 T1: -1.5000 T2: -5.5000

카테고리

Help CenterFile Exchange에서 Engines & Motors에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by