Problems in Solving 2 equations 2 unknowns

1 Ansicht (letzte 30 Tage)
czeslaw
czeslaw am 15 Nov. 2018
Kommentiert: John D'Errico am 16 Nov. 2018
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])

Akzeptierte Antwort

John D'Errico
John D'Errico am 15 Nov. 2018
Bearbeitet: John D'Errico am 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 Kommentare
czeslaw
czeslaw am 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 am 16 Nov. 2018
You can also just use a contour plot, to identify that same curve.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by