Hi. I tried doing this to my installed 2020a MATLAB but I get an error:
>> t =@(x) (heaviside(x+1)-heaviside(x-1)).*(1-abs(x));
>> t(-1)
Error using heaviside (line 36) Function call 'heaviside(0)' yields a symbolic object. Use 'sympref("HeavisideAtOrigin", v)' with some numeric value v to change 'heaviside(0)' to v.
Error in @(x)(heaviside(x+1)-heaviside(x-1)).*(1-abs(x))
I tried in the online version of 2020a and it worked. Why is it not working in my computer?
I checked if I have Symbolic Math Toolbox, and I have the same version as that in the online version. v 8.5
Best Answer