Hi,
Looks like you are trying to plot a “sdpvar” expression (YALMIP) over a given domain.
Your code does not correctly parametrize and convert the “sdpvar” expression to a function handle. Based on the given example, "p" represents a bi-variate polynomial in variables “x” and “y”, with a degree of 4. After completing the sum-of-squares decomposition and performing the required adjustments, the function handle is expected to accept two arguments – “x” and “y”. However, the error arises because you have provided only x as the input.
Refer to the following code:
[p,c] = polynomial([x y],4);
solvesos([sos(p), replace(p,[x y],[pi 2]) == 3],[],[],c);
f = sdisplay(replace(p,c,value(c)));
f = str2func(['@(x,y)' f]);
[X,Y] = meshgrid(-1:0.01:1,-1:0.01:1);
Also, it is not recommended to use “eval” for security and performance considerations. Consider using “str2func” instead.
Refer to the following MATLAB documentation for further reference:
Hope this helps!
Best regards,
Saarthak