MATLAB: Numerical integration dimension error

dimensionintegrationnumerical

ok now Im getting another type of error
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 ==> mldivide
Matrix dimensions must agree.
Whats wrong here? and how can I numerically integrate Y?

Best Answer

You need a dot before every ^, * and / when working with vectors.
Y = X.^(-1/2).*exp(-0.5*(0.00009996^2./X+34.3713^2*X));
Related Question