# why do I get error for Undefining function sdpvar and how can I solve it?

12 views (last 30 days)
Meme alcute on 12 Apr 2022
Commented: Meme alcute on 12 Apr 2022
I got an error saying:
Undefined function 'sdpvar' for input arguments of type 'double'.
Error in Untitled3 (line 1)
A=sdpvar(3,1); Tc=sdpvar(2,1); Tout=sdpvar(3,1); gam=1e5;
for the following code: Meme alcute on 12 Apr 2022
This is the code:
A=sdpvar(3,1); Tc=sdpvar(2,1); Tout=sdpvar(3,1); gam=1e5;
U=[120,80,40]; Tcin=100; T1in=300; T2in=400;
T3in=600; Tcout=500;
cons=[Tc(1)+Tout(1)-Tcin-T1in<=0,
-Tc(1)+Tc(2)+Tout(2)-T1in<=0,
Tout(3)-Tc(2)-T3in+Tcout<=0,
A(1)-A(1)*Tout(1)+gam*Tc(1)/U(1)-gam*Tcin/U(1)<=0,
A(2)*Tc(1)-A(2)*Tout(2)-gam*Tc(1)/U(2)+gam*Tc(2)/U(2)<=0,
A(3)*Tc(2)-A(3)*Tout(3)-gam*Tc(2)/U(3)+gam*Tcout/U(3)<=0,
100<=A(1)<=10000, 1000<=A([2,3])<=10000,
10<=Tc<=1000, 10<=Tout<=1000];
opt=sum(A);
optimize(cons,opt), value(A), value(Tc), value(Tout)
and here is the error: Cris LaPierre on 12 Apr 2022
You have not installed YALMIP Toolbox. Once you do, you will have access to sdpvar.
This is not a MathWorks supplied toolbox, so you will need to follow the intructions given to you to install and use this toolbox.
Meme alcute on 12 Apr 2022
I could not find the link, where is it?

R2021a

### Community Treasure Hunt

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

Start Hunting!