|
AUDSPACE - Equidistantly spaced points on auditory scale
Program code:
function [y,bw] = audspace(scale,flow,fhigh,n)
% AUTHOR : Peter L. Soendergaard
% ------ Checking of input parameters ---------
error(nargchk(4,4,nargin));
% Default parameters.
if ~isnumeric(flow) || ~isscalar(flow) || flow<0
error('%s: flow must be a non-negative scalar.',upper(mfilename));
end;
if ~isnumeric(fhigh) || ~isscalar(fhigh) || fhigh<0
error('%s: fhigh must be a non-negative scalar.',upper(mfilename));
end;
if ~isnumeric(n) || ~isscalar(n) || n<=0 || fix(n)~=n
error('%s: n must be a positive, integer scalar.',upper(mfilename));
end;
if flow>fhigh
error('%s: flow must be less than or equal to fhigh.',upper(mfilename));
end;
% ------ Computation --------------------------
audlimits = freqtoaud(scale,[flow,fhigh]);
y = audtofreq(scale,linspace(audlimits(1),audlimits(2),n));
bw=(audlimits(2)-audlimits(1))/(n-1);
|