I'm a Matlab newbie and am struggling to get the right syntax for numerically integrating a simple anonymous function on one of its variables. The M_e function (Planck's law) below is supposed to set up x (the wavelength) as the variable of interest, while the values of other parameters (h, c, k, T) are provided in earlier lines. M_e_int should integrate this function between two user-input wavelengths (lambda1, lambda2). However, I'm getting an unspecified error on the M_e_int line.
What am I doing wrong? Do I need to define x as a scalar somehow?
M_e = @(x) (2. * pi * h * c.^2) / (x.^5 * (exp((h * c)/(x * k * T)) - 1));
M_e_int = integral(M_e,lambda1,lambda2)