Hey Chris,
It looks to me that your implementation of the "sum" function is incorrect. This function only takes two inputs, but I think you are passing it four inputs. See the documentation at the link below.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!