clear all is still a bad idea, because it deletes all break points, such that you cannot use the debugger anymore. But the debugger would be a really helpful tool to find bugs. To be exact, this is exactly its purpose.
Using "error" as name of a variable causes problems, because this is a very important Matlab function. Such shadowing leads to unexpected behavior frequently.
When you "cannot get symsum to work", post your code and the occurring problems, e.g. the error message of the difference between your expectations and the results. Otherwise we cannot help you to solve the problems.