MATLAB: How to use a numerical solution to an equation as an anonymous function for an integration

anonymous functionnumerical integrationtranscendental

I am attempting to do a numerical triple integral using anonymous functions to set up the integrand. Up until now, the approximations I have made in deriving the equations have been sufficient, and to do the integral I have the code:
kf = @(k0,psi) k00+k06*cos(6*(psi))+k012*cos(12*(psi))+k31*sin(c*k0/N).*cos(3*(psi))+k20*cos(2*c*k0/N);
vperp = @(k0,psi) -3*hbar/m.*(2*k06.*sin(6.*(psi))+4*k012.*sin(12.*(psi))+k31.*sin(c.*k0./N).*cos(3.*(psi)));
v = @(k0,psi) hbar*kf(k0,psi)/m;
vx = @(k0,psi) cos(psi).*v(k0,psi)-sin(psi).*vperp(k0,psi);
integrand = @(k0,psi,psipr) vx(k0-k00*cos(phi)*sin(theta),psi).*vx(k0-k00*cos(phi)*sin(theta),psipr).*exp(psipr.*cos(theta)./wt0);
limit = @(k0,psi) psi*cos(theta)+phi;
f = e^2*cos(theta)*m/(4*pi^3*hbar^2*omega_c)*integral3(integrand,-pi/c,pi/c,phi,2*pi/cos(theta)+phi,-Inf,limit);
phi is an angle between 0 and 2pi, N=3, and hbar and m are Planck's reduced constant and the mass of the electron respectively.
However, now I have changed some parameters so that my original approximations are incorrect, so now the 1st argument of integrand must be, instead of that shown above the solution to the equation:
*x* = k0 - (k00 + k31*sin( *x* *c/3)*cos(3*psi))*cos(phi)*sin(theta
This can only be solved numerically, obviously.
I would love to know how to get this to work, either using the method I've currently been using, or by another method, so if anyone has any ideas, that would be great!
Thanks

Best Answer

integrand=@(k0,psi,psipr)...
fzero(@(x)k0-(k00+k31*sin(c/3)*cos(3*psi))*cos(phi)*sin(theta)-x,...
[xlow,xhigh] )