%Transforms the (Br, Btheta, Bphi)-components to (Bx, By, Bz)-components in MEO(longlat).
%
% Initial version: Niklas Edberg, Swedish Institute of Space Physics, Uppsala, Oct 2005

function [meo] = Bfield_sph2xyz(br,btheta,bphi,r,theta,phi)

meo(1,:) = br.*sin(theta).*cos(phi) + btheta.*cos(theta).*cos(phi) - bphi.*sin(phi);
meo(2,:) = br.*sin(theta).*sin(phi) + btheta.*cos(theta).*sin(phi) + bphi.*cos(phi);
meo(3,:) = br.*cos(theta) - btheta.*sin(theta);

