Problems in Solving 2 equations 2 unknowns

2 views (last 30 days)
Hi all,
I have this problem when trying to solve simultaneous equation below.
The error was: Warning: Cannot find explicit solution.
I try to approximate the equations using taylor, but they could not be approximated. Is there any way I could get the answers without having complex numbers in it? Or there are no solutions in it.
Thank you.
syms x y
eq1=(1+(x*100)^y)^((1-y)/y)
eq2=(1+(x*1000)^y)^((1-y)/y)
[x y]=solve(eq1==0.022,...
eq2==0.42, [x y])

Accepted Answer

John D'Errico
John D'Errico on 15 Nov 2018
Edited: John D'Errico on 15 Nov 2018
Sorry, but I have to laugh. Surely you cannot expect an analytical solution to this? Of course solve gives up.
Does any solution exist? That is not at all obvious at first sight. SO PLOT IT!
fimplicit(eq1-0.022)
hold on
fimplicit(eq2-0.42)
The solution will be where the green and blue curves cross.
Yeah, I know, I don't see any solution either. Maybe there is something for very small x, and negative y.
fimplicit(eq1-0.022,[0 .1 -10 0])
hold on
fimplicit(eq2-0.42,[0 .1 -10 0])
Ok, it looks like something may work, so if Itighten up the limits on xand y, we see this:
fimplicit(eq1-0.022,[0 .01 -2 0])
hold on
fimplicit(eq2-0.42,[0 .01 -2 0])
grid on
Now given a set of quite good starting values, we can push this into vpasolve and have half a chance.
Sol = vpasolve(eq1-0.022,eq2-0.42,x,y,[0.002 -1])
Sol =
struct with fields:
x: [1×1 sym]
y: [1×1 sym]
Sol.x
ans =
0.0017756858548836667192558390739205
Sol.y
ans =
-1.030913284117245909755343678601
Whether a solution with negative y makes any physical sense, only you know that.
  2 Comments
czeslaw
czeslaw on 16 Nov 2018
Hi John, thanks for it. Since I used matlab 2015, I could not use fimplicit, not sure how I get around it. Maybe I will use plot. though I got how the process went. And using vpasolve is a new thing for me as well. Thanks.
John D'Errico
John D'Errico on 16 Nov 2018
You can also just use a contour plot, to identify that same curve.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!