First, remove the semicolons from your dep(1)...dep(3) statements. It could be that one or more of them are returning matrices. If so, you need to figure out why and how to fix them so they will return elements of column vectors.
The NaNs are usually the result of (0/0) calculations. One NaN in the wrong place can ruin all your calculations. You need to find out what is generating them and fix it.
I don’t know what you’re doing, or what you can or can’t change to get the result you want. Only you can determine effectively what’s wrong with your code and how to fix it.
I suggest you set zrange = [0 0.1 0.2]; until you get your code running successfully.
Best Answer