function Reff = M2Reff(type, M, a) % Reff = M2Reff('type', M, a) n = 1; R = -2*n/M(2,1); ca = cos(a*pi/180); switch lower(type) case 't' Reff = R/ca; case 's' Reff = R*ca; otherwise error('unknown type') end