How to solve 4 transcendental equations of 4 unknown values?
33 次查看(过去 30 天)
显示 更早的评论
Hi. I have a problem in solving the equations. I have four equations and four unknowns and I have to find those 4 unknown variables. The equations are as follows:
syms Y2 Y3 l2 l3;
2*Y1*tan(t1_1)+Y2*tan(t2_1)+Y3*tan(t3_1)==0;
2*Y1*tan(t1_3)+Y2*tan(t2_3)+Y3*tan(t3_3)==0;
b1== (t1_1*Y1)+(t2_1*(Y2/2)*((sec(t2_1)^2)/(sec(t1_1)^2)))+(t3_1*(Y3/2)*((sec(t3_1)^2)/(sec(t1_1)^2)));
b3== (t1_3*Y1)+(t2_3*(Y2/2)*((sec(t2_3)^2)/(sec(t1_3)^2)))+(t3_3*(Y3/2)*((sec(t3_3)^2)/(sec(t1_3)^2)));
Here Y1, b1, b3, l1, lambda are known values and the unknown variables are Y2, Y3, l2, l3. The above t1 ,t2 ,t3 are in terms of l2 and l3.
Y1=0.02;
l1 = 0.0105;
lambda =[0.0426 0.0400 0.0405 0.0420];
b1=0.1079;
b3=0.03189;
t2_1=(2*pi/lambda(1))*l2;
t3_1=(2*pi/lambda(1))*l3;
t2_3=(2*pi/lambda(3))*l2;
t3_3=(2*pi/lambda(3))*l3;
t1_1=(2*pi/lambda(1))*l1;
t1_3=(2*pi/lambda(3))*l1;
I tried using vpasolve and also defining them as functions for plotting contour graphs. But I'm not able to find a solution of all positive values. Please help me with this. Thank you.
0 个评论
回答(2 个)
darova
2021-2-2
Use syms and solve
syms Y2 Y3 l2 l3
eq1 = 2*Y1*tan(t1_1)+Y2*tan(t2_1)+Y3*tan(t3_1);
eq2 = 2*Y1*tan(t1_3)+Y2*tan(t2_3)+Y3*tan(t3_3);
eq3 = b1 - (t1_1*Y1)+(t2_1*(Y2/2)*((sec(t2_1)^2)/(sec(t1_1)^2)))+(t3_1*(Y3/2)*((sec(t3_1)^2)/(sec(t1_1)^2)));
eq4 = b3 - (t1_3*Y1)+(t2_3*(Y2/2)*((sec(t2_3)^2)/(sec(t1_3)^2)))+(t3_3*(Y3/2)*((sec(t3_3)^2)/(sec(t1_3)^2)));
solve([eq1 eq2 eq3 eq4])
9 个评论
darova
2021-2-3
@Walter Roberson he has 4 uknowns
Walter Roberson
2021-2-3
I showed how to reduce the four equations into two equations. Once you have solutions to the two equations you can back-substitute to find the other two values.
Walter Roberson
2021-2-3
format long g
Q = @(v) sym(v);
syms Y2 Y3 l2 l3
Y1 = Q(0.02);
l1 = Q(0.0250);
lambda =[Q(0.1035), Q(0.0999), Q(0.0966)];
b1 = Q('11698461397958468980052614032629')/Q(10)^32;
b3 = Q('12515236662420125800636060478832')/Q(10)^32;
t2_1=(2*pi/lambda(1))*l2;
t3_1=(2*pi/lambda(1))*l3;
t2_3=(2*pi/lambda(3))*l2;
t3_3=(2*pi/lambda(3))*l3;
t1_1=(2*pi/lambda(1))*l1;
t1_3=(2*pi/lambda(3))*l1;
eq1 = 2*Y1*tan(t1_1)+Y2*tan(t2_1)+Y3*tan(t3_1);
eq2 = 2*Y1*tan(t1_3)+Y2*tan(t2_3)+Y3*tan(t3_3);
eq3 = b1 - (t1_1*Y1)+(t2_1*(Y2/2)*((sec(t2_1)^2)/(sec(t1_1)^2)))+(t3_1*(Y3/2)*((sec(t3_1)^2)/(sec(t1_1)^2)));
eq4 = b3 - (t1_3*Y1)+(t2_3*(Y2/2)*((sec(t2_3)^2)/(sec(t1_3)^2)))+(t3_3*(Y3/2)*((sec(t3_3)^2)/(sec(t1_3)^2)));
eqn = [eq1; eq2; eq3; eq4];
char(eqn)
sol1 = solve(eqn(1:2), [Y2,Y3]);
sol1.Y2
sol1.Y3
eqn2 = subs(eqn(3:4), {Y2,Y3}, {sol1.Y2, sol1.Y3})
N = 10;
sols = zeros(N,4);
for K = 1 : N
initial = randn(2,1); %COLUMN
sol2 = vpasolve(eqn2, [l2, l3], initial);
backY2 = subs(sol1.Y2, sol2);
backY3 = subs(sol1.Y3, sol2);
sols(K,:) = vpa([backY2, backY3, sol2.l2, sol2.l3]);
end
sols
9 个评论
Walter Roberson
2021-3-7
For the first set of inputs, look at pretty(sol1.Y2)
/ 233 pi \ / 4000 pi l3 \ / 100 pi \ / 10000 pi l3 \
tan| ------ | tan| ---------- | + tan| ------ | tan| ----------- |
\ 483 / \ 207 / \ 207 / \ 483 /
- ----------------------------------------------------------------------------------
/ / 4000 pi l2 \ / 10000 pi l3 \ / 4000 pi l3 \ / 10000 pi l2 \ \
| tan| ---------- | tan| ----------- | - tan| ---------- | tan| ----------- | | 25
\ \ 207 / \ 483 / \ 207 / \ 483 / /
and compare to pretty(sol1.Y3)
/ 233 pi \ / 4000 pi l2 \ / 100 pi \ / 10000 pi l2 \
tan| ------ | tan| ---------- | + tan| ------ | tan| ----------- |
\ 483 / \ 207 / \ 207 / \ 483 /
----------------------------------------------------------------------------------
/ / 4000 pi l2 \ / 10000 pi l3 \ / 4000 pi l3 \ / 10000 pi l2 \ \
| tan| ---------- | tan| ----------- | - tan| ---------- | tan| ----------- | | 25
\ \ 207 / \ 483 / \ 207 / \ 483 / /
The denominators are the same and the numerators have the same form except that one involves l2 and the other involves l3, and there is a negative sign involved.
In order for both of them to be positive, both numerators must have the same sign, and that sign has to be the same as the denominator. Which implies that the sign of the terms with l3 must be negative of the sign of the terms with l2 for the same structure.
This is not impossible, but it is going to take some work to find.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Equation Solving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!