Have you carefully read the documentation of these functions, and are you certain you are calling them correctly? John D'Errico's submissions are typically flawless.
Almost certainly, you have some kind of dimension mismatch. It looks like you should be calling polyvaln like this:
where X is an N-by-8 numeric array (if I understand the syntax correctly).
May I suggest you post your code and a small sample that exhibits the problem? Otherwise, we'll just be guessing at the solution.