I have two equations and two unknowns, I use solve to find the answer bud there is no explicit answer for the equations, how I should use fminunc or fmincon for two equations and two unknowns?
2 views (last 30 days)
Show older comments
R1_d=1.28e-05;
R2_d=8.42e-05;
d1=15;
d2=16.4;
A=sqrt(2);
eq1= R1_d==((x+(1/(sqrt((1/y)^2+d1^2))))*(exp(-x*(sqrt((1/y)^2+d1^2)))/((sqrt((1/y)^2+d1^2))^2))+(((4*A/3)+1)*(x+(1/(sqrt((((4/3)*A+1)/y)^2+d1^2))))*(exp(-x*(sqrt((((4/3)*A+1)/y)^2+d1^2)))/((sqrt((((4/3)*A+1)/y)^2+d1^2))^2))))/(4*pi*y);
eq2= R2_d==((x+(1/(sqrt((1/y)^2+d2^2))))*(exp(-x*(sqrt((1/y)^2+d2^2)))/((sqrt((1/y)^2+d2^2))^2))+(((4*A/3)+1)*(x+(1/(sqrt((((4/3)*A+1)/y)^2+d2^2))))*(exp(-x*(sqrt((((4/3)*A+1)/y)^2+d2^2)))/((sqrt((((4/3)*A+1)/y)^2+d2^2))^2))))/(4*pi*y);
S=solve(eq1,eq2);
S=vpa(S);
miu_eff=S(1);
miu_prime_t=S(2);
this is the code
0 Comments
Answers (1)
Walter Roberson
on 24 Jun 2015
There is no simultaneous solution.
Solve the first equation for x, getting a symbolic answer. Substitute that answer for the value of x in the second equation. Take the right hand side minus the left hand side; the result must be 0 in the places the equation holds. Do a numeric plot of the real and imaginary parts of the expression over the range of y from about -10 to +10.
You will see that after about +6.88 (roughly) the imaginary part starts becoming non-zero, so it is not possible that there are further solutions at higher y. On the left side you will see the values settle in at about -0.0000700280, effectively a left asymptope, so you will not be able to find any solutions at lower y.
On the graph itself, you will see a peak at about y = -1/4 and a minima at about y = +1/4, and you may see a little kink right near y = 0 (there is a discontinuity at 0.) But you won't see the graph cross 0 anywhere in that range.
So... the reason those solvers did not work for you is that there is no solution to both equations simultaneously.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!