I am trying to findout maximum value of a equation of two variable but there are some error

an = 1500;
bn = 0.0022;
Mn = 0.024;
gn = 10^-15; %channel gain from CBS to nth energy harvesting SU
mu_n = 3;
syms x y
eqns = Mn - mu_n*(1+exp(-an*(gn*(x + y)-bn)));
subs(eqns);
dx = diff(eqns,x);
dy = diff(eqns,y);
r= diff(eqns,x,2);
t= diff(eqns,y,2);
s= diff(dx,y);
sol = vpasolve([dx,dy])
r = subs(r,{x,y},{sol.x,sol.y})
s = subs(t,{x,y},{sol.x,sol.y})
t = subs(s,{x,y},{sol.x,sol.y})
A = [r].*[t];
B = [s].^2;
A = abs(A);
B = abs(B);
if A>B
if r > 0
disp(‘minima’);
else
disp(‘maxima’);
end
elseif A < B
disp(‘no minima & no maxima’);
else
disp(‘no solution’);
end
subs(eqns,{x,y},{sol.x,sol.y})

Hi @neelu05,

Could you provide more details of what you are trying to achieve? This may help community members to connect with your question and provide a solution from their experience. 

Also, this post was moved to a different board that fits your topic of discussion a bit better. This means you’ll get better engagement on your post, and it keeps our community organized so users can more easily find information.

As you’ll notice, your topic is now here in the Project Development Help and Advice board. No action is needed on your part; you can continue the conversation as normal here.

Cheers!