from
Elliptic Bumps
by Roy Schestowitz
Generate and display sets of elliptic bumps
|
| normalise_to_bounds(data, lower_bound, upper_bound)
|
function normalised_data = normalise_to_bounds(data, lower_bound, upper_bound)
% NORMALISE_TO_BOUNDS: Normalises data to lie within boundaries.
%
% ABOUT
%
% -Created: November 23rd, 2003
% -Last update: Novermber 26th, 2003
% -Revision: 0.0.7
% -Author: Katherine Smith, R. S. Schestowitz, University of Manchester
% ==============================================================
if(nargin ==1)
% set some range defaults if no arguments given
lower_bound = 0;
upper_bound = 1;
end
mins = min(data);
% get minimum of data
data_less_mins = data - repmat(mins,size(data,1),1);
% subtract minimum from data, i.e. shift it as close
% as possible to x axis without reaching negative values
maxs = max(data_less_mins);
% get maximum of the data above (global maximum of curve)
normalised_data = lower_bound + (data_less_mins ./ repmat(maxs,size(data,1),1)) * (upper_bound - lower_bound);
|
|
Contact us at files@mathworks.com