<t>Hansi, I realize this thread is very old. But if you are still on here or someone else has the knowledge, I am trying to do the same thing Pascoe was. I built a vba function modelling your matlab code but since I am not familiar with matlab I had to make a few guesses. (Incorrect ones apparently)...