solving 5 non linear simultaneous equation
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Bibek Tripathi
le 30 Avr 2016
Réponse apportée : Alex Sha
le 1 Août 2019
I have a set of 5 non-linear equations. first 4 equations are h,k,a,b --> in terms of variable 'bsfc'. the fifth equation bsfc^2 in terms of h,k,a,b. So i have 5 equations and 5 variables. This programming is basically finding the radius of the rotated ellipse. I have my x and y values too. However I am not getting the right solution.
The right solution is bsfc=246
I have my code here:
syms bsfc h k a b
y=86;
x=1717;
phi=0;
eqn1= h == 9.514*bsfc;
eqn2= k == 0.0001*(bsfc+1)^2-0.07*bsfc+19;
eqn3= a == 10* atan(bsfc/30 - 5.8) -3.5;
eqn4= b == 0.025 * atan(bsfc/20 - 10.3) -0.022;
eqn5= bsfc^2 == (((x-h)*cos(phi)+(y-k)*sin(phi))^2/(a^2)+ ((x-h)*sin(phi)-(y-k)*cos(phi))^2/(b^2))
sol=solve([eqn1,eqn2,eqn3,eqn4,eqn5],bsfc,h,k,a,b);
hSol = sol.h
kSol = sol.k
aSol = sol.a
bSol = sol.b
bsfcSol = sol.bsfc
0 commentaires
Réponse acceptée
Walter Roberson
le 1 Mai 2016
Given those equations, bsfc approximately 1154.643046927194 or approximately 1325.553297436922
Your proposed value 246 does not come at all close to satisfying eqn5
8 commentaires
Walter Roberson
le 2 Mai 2016
syms bsfc h k a b x y phi;
Q = @(v) sym(v);
eqn1 = h == Q(9.514)*bsfc;
eqn2 = k == Q(0.1e-3)*(bsfc+1)^2-Q(0.7e-1)*bsfc+19;
eqn3 = a == 10*atan((1/30)*bsfc-Q(5.8))-Q(3.5);
eqn4 = b == Q(0.25e-1)*atan((1/20)*bsfc-Q(10.3))-Q(0.22e-1);
eqn5 = bsfc^2 == ((x-h)*cos(phi)+(y-k)*sin(phi))^2/a^2+((x-h)*sin(phi)-(y-k)*cos(phi))^2/b^2;
sol_hkab = solve([eqn2,eqn3,eqn4,eqn5],[h, k, a, b]);
eqn_bsfc1 = subs(eqn1, [h k a b], [sol_hkab.h(1), sol_hkab.k(1), sol_hkab.a(1), sol_hkab.b(1)]);
eqn_bsfc2 = subs(eqn1, [h k a b], [sol_hkab.h(2), sol_hkab.k(2), sol_hkab.a(2), sol_hkab.b(2)]);
xyt = [Q(1256.97), Q(7.076), Q(0.00044)];
bs = linspace(0,750,2000);
s_bsfc1 = subs(eqn_bsfc1, [x y phi], xyt);
eq1f = matlabFunction(feval(symengine,'lhs',s_bsfc1)-feval(symengine,'rhs',s_bsfc1));
eq1fr = @(x) real(eq1f(x));
eq1fi = @(x) imag(eq1f(x));
s_bsfc2 = subs(eqn_bsfc2, [x y phi], xyt);
eq2f = matlabFunction(feval(symengine,'lhs',s_bsfc2)-feval(symengine,'rhs',s_bsfc2));
eq2fr = @(x) real(eq2f(x));
eq2fi = @(x) imag(eq2f(x));
plot(bs, eq1fi(bs), 'b--', bs, eq2fi(bs), 'g--', bs, eq1fr(bs), 'b-', bs, eq2fr(bs), 'g-');
legend({'imag sol1', 'imag sol2', 'real sol1', 'real sol2'});
and then start zooming in on places where the imaginary is 0, looking for real solutions.
Plus de réponses (2)
Alex Sha
le 31 Juil 2019
Look this result:
h: -4113.26496133792
bsfc: -432.338129213572
k: 67.8689272162873
a: -18.7135929756326
b: -0.0604868803921316
0 commentaires
Alex Sha
le 1 Août 2019
one more solution:
h: 10985.2739483926
bsfc: 1154.64304691955
k: 71.7260719049847
a: 11.9021369375982
b: 0.0167429176020812
0 commentaires
Voir également
Catégories
En savoir plus sur Calculus dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!