How can I find intersection points without mouse?
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I hope you are keeping safe.
Couls you please help me regarding my matlab code, It is urgent and I would appreciate if you help me. I want to find intersections in this plot without mouse(Using code).
%% Input Parameters
clear all
clc
alpha1=input('Enter positive "alpha1"?');
alpha2=input('Enter positive "alpha2"?');
beta1=input('Enter positive "beta1"?');
beta2=input('Enter positive "beta2"?');
lambda=input('Enter positive "lambda"?');
eta1=input('Enter positive "eta1"?');
eta2=input('Enter positive "eta2"?');
P=input('Enter positive "P"?');
%% Feasible Area
x = -1:P;m = 0; c = eta2; y = m * x + c;
plot(x, y, 'black')
y = -1:P; m = 0; c = eta1; y = m * x + c;
plot(y, x, 'black')
eta1=min (eta1,P); eta2=min (eta2,P);
if eta1+eta2<P
X=[0 0 eta1 eta1]; Y=[0 eta2 eta2 0];
fill(X,Y,[0.85 0.85 0.85]);
else
X=[0 0 P-eta2 eta1 eta1]; Y=[0 eta2 eta2 P-eta1 0];
fill(X,Y,[0.85 0.85 0.85]); axis([-1 P -1 P])
end
X=[0 0]; Y=[0 P];
line(X,Y,'Color','black')
hold on
line(Y,X,'Color','black')
g = @(x,y) x+y-P;
gp =fimplicit(g,[0 P 0 P], 'black')
f = @(x,y) log((1+alpha1*x./(1+alpha2*y))) -lambda*log((1+beta1*x./(1+beta2*y)));
fp =fimplicit(f,[-1 P -1 P], '-')
hold on
grid on
For alpha1=1 , alpha2=0.2, beta1=1,beta2=2, lambda=2, eta1=3,eta2=4, P=2
Many Thanks in advance
3 个评论
Jan
2021-3-8
Some members of this forum react allergic to the term "urgent", see e.g. https://www.mathworks.com/matlabcentral/answers/29922-why-your-question-is-not-urgent-or-an-emergency .
You are drawing some objects. I cannot guess between which of these obejcts you want to locate the interection. The more the readers have to guess, the longer takes it to answer.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!