How can I solve this implicit function in MatLab?

13 ビュー (過去 30 日間)
João Pedro
João Pedro 2024 年 5 月 10 日
コメント済み: João Pedro 2024 年 5 月 11 日
I have the implicit function f1 = @(x,y) a*log(y) - alpha*y + b*log(x) - beta*x - k1 and with the fimplicit command it is possible to plot a graph. I need to create an output with the x and y values ​​used to plot this graph. Is there a way to obtain these values? a, alpha, b, beta and k1 are known.

採用された回答

John D'Errico
John D'Errico 2024 年 5 月 10 日
編集済み: John D'Errico 2024 年 5 月 10 日
Trivial, in some eyes. ;-) This is one of the simpler implicit problems you might write down, since a direct solution exists in the form of the Wright omega function.
syms a y x alpha k1 b beta
ysol(x,a,b,alpha,beta,k1) = solve(a*log(y) - alpha*y + b*log(x) - beta*x - k1,y)
ysol(x, a, b, alpha, beta, k1) = 
And of course, you have not provided any of the constants. But if you did, I could even evaluate it.
ysol(3,4,5,6,7,8)
ans = 
double(ysol(1,2,3,4,5,6))
ans = -2.2686 + 1.3091i
I'd bet for some sets of those parameters, the result will even be real. I don't need to change a lot.
double(ysol(1,-2,3,4,5,6))
ans = 0.0041
  1 件のコメント
João Pedro
João Pedro 2024 年 5 月 11 日
Thank you very much, this answer helped a lot. I learned one more thing. What I needed most was a y(x) function. Just one more question, how can the omega variable that appears be determined? Below I leave the values ​​that I am using in the problem.
a = 12;
b = 6;
alpha = 4;
beta = 2.5;
x0 = 2.5;
y0 = 1.5;
k1 = a*log(y0) - alpha*y0 + b*log(x0) - beta*x0;
f1 = @(x,y) a*log(y) - alpha*y + b*log(x) - beta*x - k1;
fp = fimplicit(f1,[0 7 0 6]);

サインインしてコメントする。

その他の回答 (1 件)

Steven Lord
Steven Lord 2024 年 5 月 10 日
Let's take a simpler example and call fimplicit with an output argument, the handle of the graphics object that fimplicit plots.
f1 = @(x,y) x.^2-y.^2+sin(x).*cos(y);
h = fimplicit(f1);
Among the properties the object h returned from fimplicit has are XData and YData properties.
X = h.XData;
Y = h.YData;
Let's plot the X and Y data to see if it gives us the same plot.
figure
plot(X, Y)
  1 件のコメント
João Pedro
João Pedro 2024 年 5 月 11 日
Thanks for the answer, getting the entire set of points used to build the graph with the fp.XData and fp.YData commands helped a lot too.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by