function Magi = interpmag(Editor,W,Mag,Wi)
%INTERPMAG  Interpolates magnitude data in the visual units.

%   Author(s): P. Gahinet
%   Copyright 1986-2000 The MathWorks, Inc. 
%   $Revision: 1.2 $ $Date: 2000/06/14 20:19:41 $

% RE: MAG and MAGI are expressed in abs units. The interpolation occurs
%     in abs or log scale depending on the mag. scale and units

if strcmp(Editor.MagnitudeUnits,'abs') & ...
        strcmp(Editor.MagnitudeScale,'linear')
    % Interpolate natural magnitude
    Magi = interp1(W,Mag,Wi);
else
    % Interpolate log of magnitude
    Magi = pow2(interp1(W,log2(Mag),Wi));
end
    