MATLAB: Numerical integration error

numerical integrationscalartrapz

How come I get an error? What does this mean?
X = 0:1:100; Y = X^(-1/2)*exp(-0.5*(0.00009996^2/X+34.3713^2*X)); Z = trapz(X,Y)
??? Error using ==> mpower
Inputs must be a scalar and a square matrix.
How can I numerically integrate the function Y?

Best Answer

You need a '.' before your '^', i.e:
Y = X.^(...)