How can I solve this implicit function in MatLab?

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.

 采纳的回答

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 个评论

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 个)

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 个评论

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.

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Mathematics 的更多信息

产品

版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by