I took a look at the code and I am not sure what you want to be doing with it. For example you don't even look at the output, so how do you know it is not getting the results you want. In addition I am not sure what plot you are refering to.
What I would suggest is see if the code works in Matlab as an m file. Once it works there import that into the script node, and then send in the inputs needed.