How I plot this ?

2 views (last 30 days)
Hossein Alishahi
Hossein Alishahi on 4 Mar 2021
Commented: the cyclist on 6 Mar 2021
Please help me to plot this equation
Thanks in advance
log((1+alpha1*x/(1+alpha2*y))) -gamma*log((1+beta1*x/(1+beta2*y)));
alpha1=0.1; alpha2=0.2; beta1=0.2; beta2=1; gamma=1.3;

Accepted Answer

the cyclist
the cyclist on 4 Mar 2021
Here is one way:
alpha1=0.1; alpha2=0.2; beta1=0.2; beta2=1; gamma=1.3;
x = 0 : 0.1 : 10;
y = 0 : 0.1 : 10;
[xx,yy] = meshgrid(x,y);
f = log((1+alpha1*xx./(1+alpha2*yy))) -gamma*log((1+beta1*xx./(1+beta2*yy)));
figure
surf(x,y,f)
  2 Comments
the cyclist
the cyclist on 4 Mar 2021
Answering the comment you placed here, then deleted.
alpha1=0.1; alpha2=0.2; beta1=0.2; beta2=1; gamma=1.3;
x = 0 : 0.1 : 10;
y = 0 : 0.1 : 10;
[xx,yy] = meshgrid(x,y);
f = zeros(size(xx));
figure
surf(x,y,f)
(I saw that you also emailed me, but I don't answer via email, so better to post here.)
Hossein Alishahi
Hossein Alishahi on 4 Mar 2021
Thank you.
But I meant
f = log((1+alpha1*xx./(1+alpha2*yy))) -gamma*log((1+beta1*xx./(1+beta2*yy)))==0
please help me in this problem

Sign in to comment.

More Answers (1)

the cyclist
the cyclist on 4 Mar 2021
Edited: the cyclist on 4 Mar 2021
You can use the fimplicit function.
alpha1=0.1; alpha2=0.2; beta1=0.2; beta2=1; gamma=1.3;
f = @(x,y) log((1+alpha1*x./(1+alpha2*y))) -gamma*log((1+beta1*x./(1+beta2*y)));
figure
fimplicit(f,[0 100 0 10]) % Chose these plot limits after a little experimentation
  2 Comments
Hossein Alishahi
Hossein Alishahi on 6 Mar 2021
I have below code
%% Input Values
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==0 && eta2==0;
X=[0 0 P]; Y=[0 P 0];
fill(X,Y,[0.85 0.85 0.85]); axis([-1 P -1 P])
end
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;
y1=fimplicit(g,[0 P 0 P])
f = @(x,y) log((1+alpha1*x./(1+alpha2*y))) -lambda*log((1+beta1*x./(1+beta2*y)));
y2=fimplicit(f,[-1 P -1 P], '-')
hold on
grid on
Where I consider alpha1=1, alpha2=0.2, beta1=1; beta2=2, lambda=2, eta1=2, eta2=3, P=1
I want to find the intersection for lines in the picture. Could you please help me!
the cyclist
the cyclist on 6 Mar 2021
You might want to post a new question, so more people see this. I don't see the answer right away, and I don't think I'm going to get a chance to think about it more for a while.

Sign in to comment.

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!