I got the function result without error message, but when I used this function again with other real x, mu and sigma values, I got the following error message: “??? Subscript indices must either be real positive integers or logicals.” I did not find a comment which alludes to this problem in the Matlab help. Could someone explain why I got this message and how I can solve this problem?