Solving 5 very complicated equations with 5 unknowns
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I'm trying to derive a zoom lens and this equation is what i came across. Currently, I'm trying to find 5 variables with 5 equations(feq1, feq2, feq3, feq4, feq5).The equations were generated as shown below.
syms f1 f2 f3 f4 fe p2 p3;
fl = @(f1, f2, d) 1/(1/f1 + 1/f2 - d/(f1 * f2)); %focal length formula
bfl = @(f1, f2, d) (f2 * (d - f1)) / (d - (f1 + f2)); %back focal length formula
f_34 = fl(f4, f3, p3);
bfl_34 = bfl(f4, f3, p3);
f_234 = fl(f_34, f2, bfl_34+p2-p3);
bfl_234 = bfl(f_34, f2, bfl_34 + (p2-p3));
f_1234 = fl(f_234, f1, bfl_234 + (80-p2));
bfl_1234 = bfl(f_1234, fe, bfl_234 + (80 - p2));
f_1234e = fl(f_1234, fe, bfl_1234 + (125 - 80)) % The equation of the lens system
%% substituting p2 and p3 in my equation
feq1 = subs(subs(f_1234e, p2, 63.8654),p3, 44.6468) == 179.0893;
feq2 = subs(subs(f_1234e, p2, 57.8781),p3, 43.4521) == 166.8919;
feq3 = subs(subs(f_1234e, p2, 52.4784),p3, 41.9933) == 151.9181;
feq4 = subs(subs(f_1234e, p2, 49.7862),p3, 40.6357) == 143.6190;
feq5 = subs(subs(f_1234e, p2, 44.6669),p3, 36.5343) == 122.4775;
Which is very complicated.
I've aleady tried solve() and vpasolve(), but their outputs were empty.
Attempt #1:
S = vpasolve([feq1, feq2, feq3, feq4, feq5],[f1 f2 f3 f4 fe]);
Attempt #2:
S = solve([feq1, feq2, feq3, feq4, feq5]);
Please tell me if i've got something wrong or other ways to solve this hard question.
Thanks!
0 commentaires
Réponse acceptée
Torsten
le 22 Déc 2022
syms f1 f2 f3 f4 fe p2 p3
fl = @(f1, f2, d) 1/(1/f1 + 1/f2 - d/(f1 * f2)); %focal length formula
bfl = @(f1, f2, d) (f2 * (d - f1)) / (d - (f1 + f2)); %back focal length formula
f_34 = fl(f4, f3, p3);
bfl_34 = bfl(f4, f3, p3);
f_234 = fl(f_34, f2, bfl_34+p2-p3);
bfl_234 = bfl(f_34, f2, bfl_34 + (p2-p3));
f_1234 = fl(f_234, f1, bfl_234 + (80-p2));
bfl_1234 = bfl(f_1234, fe, bfl_234 + (80 - p2));
f_1234e = fl(f_1234, fe, bfl_1234 + (125 - 80)); % The equation of the lens system
%% substituting p2 and p3 in my equation
feq1 = subs(subs(f_1234e, p2, 63.8654),p3, 44.6468) == 179.0893;
feq2 = subs(subs(f_1234e, p2, 57.8781),p3, 43.4521) == 166.8919;
feq3 = subs(subs(f_1234e, p2, 52.4784),p3, 41.9933) == 151.9181;
feq4 = subs(subs(f_1234e, p2, 49.7862),p3, 40.6357) == 143.6190;
feq5 = subs(subs(f_1234e, p2, 44.6669),p3, 36.5343) == 122.4775;
f = [feq1;feq2;feq3;feq4;feq5];
f = lhs(f)-rhs(f);
f = matlabFunction(f);
F = @(x)f(x(1),x(2),x(3),x(4),x(5));
f0 = [68;35;-14;96;186];
sol = fsolve(F,f0)
Plus de réponses (1)
Bradley Chen
le 21 Déc 2022
2 commentaires
Torsten
le 21 Déc 2022
I suspect there will be many more "answers" depending on the initial guesses for the unknowns. At least "fsolve" showed this behaviour when using it for your problem.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

