필터 지우기
필터 지우기

How can I solve this implicit function in MatLab?

조회 수: 7 (최근 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 CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by