MATLAB: Error: Subscript indices must either be real positive integers or logicals. Please help me. My code

subscript indices must either be real positive integers or logicals.

N3 = @(z)(exp(-(m+n)*z).*(-exp(2*l*n+(m+n)*z).*lamda.*n^2.*(3*m-(1+l*m)*n+l*lamda*n^4)+exp(n*(2*l+z)).*lamda^2.*n^6.*(l-z)+exp(l*(m+n)+m*z).*m^2.*(l*n*(l-z)-z)+exp(l*m+(m+n)*z).*m^2.*z-exp(l*n+(m+n)*z).*lamda.*n^3.*(-2*m+n).*z+exp(l*m+2*l*n+n*z).*lamda.*n^2.*(3*m-n-m*n*z+lamda*n^4*z)-exp(2*l*n+m*z).*lamda.*n^2.*(n+m*(-3+l*n-n*z))-exp(l*(m+n)+n*z).*lamda.*n^2.*(-n*(1+l*n)+m*(3+l*n*(3+l*n)-n*(1+l*n)*z))+exp(l*m+2*l*n+m*z).*(m^2*z+lamda*n^2*(n-m*(3+n*z)))-exp((m+n)*(l+z)).*(l^2*m*n*(m-lamda*n^3)+m^2*z+lamda*n^2*(-3*m+n+(2*m-n)*n*z)+l*n*(-m^2*z+lamda*n^2*(n+m(-3+n*z))))))/((exp(l*m).*m^2-exp(l*n).*lamda.*n^3.*(-2*m+n)+exp(l*(m+2*n)).*(m^2+2*lamda*m*n^3-lamda*n^4)+exp(2*l*n).*lamda.*n^3.*(n+m*(-2+l*n))-exp(l*(m+n)).*(-lamda*n^4+lamda*m*n^3*(2+l*n)+m^2*(2+l^2*n^2))));

Best Answer

Hint: Never define a variable named exp. If you do, you will get that error.
Try this:
which exp -all
If that is not the problem, then look carefully at your code. Is there ANY place where you have a variable with NO operator between the variable and an open parens? Consider this line from your code:
n)*n*z)+l*n*(-m^2*z+lamda*n^2*(n+m(-3+n*z))))))/((exp(l*m).*m^2-exp(l*n).*lamda.*n^3.*
What might you have intended by the fragment m(-3+n*z)?
Is m a function? Is m a variable to be indexed by the expression -3+n*z? Or did you really intend there to be an operator between the m and the ( ?
When you get an error like this, look carefully at your code. If I could find it easily enough, surely you could have found it in much less time than it took me to answer this question.
There may be other errors. Check your code.