First off, I do have to apologize, because I'm very sure that I'm simply making a simple mistake. I am making my first program in MatLab, and have been reading up on the relevant documentation, but simply still can't seem to solve my problem.
I am trying to implement the equation for information entropy in MatLab (I'm sure it probably already exists, but that's beside the point), but I am having issues with arrayfun as it seems to be calling entropySingle with no arguments.
I have the following functions in appropriately named files
function y = entropySingle(x)
y = x * log2(x);
end
and
function y = entropy(x)
if ~isvector(x)
error('Input must be a vector');
end
x = arrayfun(entropySingle, x);
y = sum(x);
end
and I'm calling entropy([1/3 1/4 1/6 1/8 1/12 1/24]). The error occurs on line 2 of entropySingle, but why is it being called with a null pointer? Thanks in advance,