Calculus Matlab two variables
1 view (last 30 days)
Show older comments
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163355/image.jpeg)
% code
clear all
a) -------------------------
r1 = linspace (1,4);
r2 = linspace (1,10);
c1 = 4 + r1 + r1.^2
c2 = 25./(1+(exp(1)).^(-r2+6))
ctot = c1 + c2
plot (ctot)
b) -------------------------
r1 = linspace (1,4);
r2 = linspace (1,10);
c1 = 4 + r1 + r1.^2
c2 = 25./(1+(exp(1)).^(-r2+6))
ctot = c1 + c2
plot3(c1,c2,ctot)
hold on
z = 8.*r1+3.*r2-24
r_1 = 8.*r1
r_2 = 3.*r2
z = linspace (24,24);
plot3 (r_1,r_2,z)
end
This is how far ive come. I know this problem should be really simple to solve, but i struggle. I have no clue about c,d,e part questions.
Answers (1)
xi
on 25 Apr 2017
Try this, using fmincon(), to solve the min problem
x0=[1,1]; Aeq=[8,3]; beq=24; lb=[1,1]; ub=[4,10];
fun=@(x)4+x(1)+x(2)^2+25/(1+exp(-x(2)+6)); [x val] = fmincon(fun,x0,[],[],Aeq,beq,lb,ub);
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!