In MATLAB R2020b I have the following code:
f=@(x) x.^2;
y=2;
g=@(x) f(x).*y
and the output is
g = function_handle with value: @(x)f(x).*y
But y = 2
, so I would expect the output to be @(x)f.*2
. Is this how its supposed to work or a bug? And can I display it as f.*2
rather than f.*y
?