function semiminor = minaxis(in1,in2)
%MINAXIS  Semiminor axis of ellipse
%
%  Support for nonscalar input, including the syntax b = MINAXIS(vec), will
%  be removed in a future release.
%
%  b = MINAXIS(semimajor,e) computes the semiminor axis of an ellipse
%  (or ellipsoid of revolution) given the semimajor axis and eccentricity.
%
%  b = MINAXIS(vec) assumes a 2 element vector (vec) is supplied,
%  where vec = [semimajor, e].
%
%  See also AXES2ECC, FLAT2ECC, MAJAXIS, N2ECC, oblateSpheroid

% Copyright 1996-2023 The MathWorks, Inc.
% Written by:  E. Byrns, E. Brown

narginchk(1,2)
if nargin == 1
    validateattributes(in1,{'numeric'},{'real'},mfilename,'vec')
    if ~isequal(sort(size(in1)),[1 2])
        error(message("map:validate:mustBeTwoElementVector"))
    else
        semimajor = in1(1);
        eccent = in1(2);
    end
elseif nargin == 2
    semimajor = in1;
    eccent = in2;
    validateattributes(semimajor,{'numeric'},{'real'},mfilename,'semimajor',1)
    validateattributes(eccent,{'numeric'},{'real'},mfilename,'eccentricity',2)
    if ~isequal(size(semimajor),size(eccent))
        error(message("map:validate:inconsistentDimensions"))
    end
end

%  Compute the semiminor axis
semiminor = semimajor .* sqrt(1 - eccent.^2);
