Two variables multiple constraints in calculus.
Show older comments
<<se-mathworks-com-matlabcentral-answers-uploaded_files-76159-problem_4_5-jp.ng>>
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) -------------------------
Dont know how to plot (Ctot) alongs the constraint 8r1+3r2=24
c) -------------------------
Think i got this one right
r0=[1,1];
Aeq=[8,3];
beq=24;
lb=[1,1];
ub=[4,10];
fun=@(r)4+r(1)+r(1)^2+25/(1+exp(-r(2)+6));
[r fval,EXITFLAG , OUTPUT] = fmincon(fun,r0,[],[],Aeq,beq,lb,ub);
X = fminsearch (fun, r0)
d)-------------------------
Struggling abit with this one.
i know that i can calculate second derivative with diff(Ctot,2) but dont know how to calcualte dCtot/dr(2)
e)-------------------------
I know how to calculate gradient with grad(Ctot = gradient(Ctot) but dont know how to calculate the gradient of the constraint in solvingpoint.
r
fval
OUTPUT.message
This is how far i've come. I know this problem should be really simple to solve, but i struggle. I have no clue about b, d, e part questions.
1 Comment
Walter Roberson
on 29 Apr 2017
+1. Thank you for specifically saying which parts you are having difficulty with.
Accepted Answer
More Answers (0)
Categories
Find more on Data Distribution Plots 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!