MATLAB: Can I use ‘fplot’ with symbolic bounds

Symbolic Math Toolbox

I would like to plot a function between bounds defined by symbolic variables:
>> syms x y(x)
>> y(x) = 2*x^3;
>> xmin = sym(1);
>> xmax = sym(2);
Can I plot 'y(x)' between 'xmin' and 'xmax' using 'fplot'?

Best Answer

'fplot' does not support symbolic bounds, but you can convert the symbolic variables 'xmin' and 'xmax' to doubles (if they evaluate to a number, rather than a function) using the 'double' command: