You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to YALMIP
Dear Johan,
I would like to replace symbolic variables by sdp variabes in a cost function. I saw the thread below and tried to do the same. However, symbolic variable was not converted into sdp variable. Matlab version is 2020a.2017/04/26 21:13:46:substitute sdp variable for symbolic variable
syms x f = 3*x; sdpvar x isa(f,'sdpvar')
In 2020a, the above result is "0". Thank you in advance for your help!
Yuzuna
Johan Löfberg
unread,
Jul 5, 2022, 2:40:19 AM7/5/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to YALMIP
Why would you expect it to return anything but 0? The code clearly shows that f is created from a syms
I guess you want to deriva a complicated expression using syms, and then mirror that expression on an sdpvar, i.e. someing like eval(char(f),x)
Johan Löfberg
unread,
Jul 5, 2022, 3:21:38 AM7/5/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to YALMIP
that should be just eval(char(f)), no second argument
Yuzuna Horiuchi
unread,
Jul 5, 2022, 3:38:39 AM7/5/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to YALMIP
Thank you kindly. That is the answer I was looking for.