============================================================== NORMALISE_TO_BOUNDS: Normalise data to lie within boundaries. Code written by Katherine Smith, 2003 GENERAL normalised_data = normalise_to_bounds(data, lower_bound, upper_bound) INPUT/S -data: Input images data. -lower_bound: Lower bound that the data must not lie under. -upper_bound: Upper bound for the data to lie below. OUTPUT/S -normalised_data: The data in normalised state. PENDING WORK - KNOWN BUG/S -None. COMMENT/S -What is the exact nature of normalisation? RELATED FUNCTION/S ABOUT -Created: November 23rd, 2003 -Last update: Novermber 26th, 2003 -Revision: 0.0.2 -Author: R. S. Schestowitz, University of Manchester ==============================================================
0001 function normalised_data = normalise_to_bounds(data, lower_bound, upper_bound) 0002 % ============================================================== 0003 % NORMALISE_TO_BOUNDS: Normalise data to lie within boundaries. 0004 % 0005 % Code written by Katherine Smith, 2003 0006 % 0007 % GENERAL 0008 % 0009 % normalised_data = normalise_to_bounds(data, lower_bound, upper_bound) 0010 % 0011 % INPUT/S 0012 % 0013 % -data: 0014 % Input images data. 0015 % 0016 % -lower_bound: 0017 % Lower bound that the data must not lie under. 0018 % 0019 % -upper_bound: 0020 % Upper bound for the data to lie below. 0021 % 0022 % OUTPUT/S 0023 % 0024 % -normalised_data: 0025 % The data in normalised state. 0026 % 0027 % PENDING WORK 0028 % 0029 % - 0030 % 0031 % KNOWN BUG/S 0032 % 0033 % -None. 0034 % 0035 % COMMENT/S 0036 % 0037 % -What is the exact nature of normalisation? 0038 % 0039 % RELATED FUNCTION/S 0040 % 0041 % 0042 % 0043 % ABOUT 0044 % 0045 % -Created: November 23rd, 2003 0046 % -Last update: Novermber 26th, 2003 0047 % -Revision: 0.0.2 0048 % -Author: R. S. Schestowitz, University of Manchester 0049 % ============================================================== 0050 0051 0052 0053 0054 if(nargin ==1) % set some range defaults if no arguments given 0055 lower_bound = 0; 0056 upper_bound = 1; 0057 end 0058 0059 mins = min(data); 0060 % get minimum of data 0061 data_less_mins = data - repmat(mins,size(data,1),1); 0062 % subtract minimum from data, i.e. shift it as close 0063 % as possible to x axis without reaching negative values 0064 maxs = max(data_less_mins); 0065 % get maximum of the data above (global maxima of curve) 0066 normalised_data = lower_bound + (data_less_mins ./ repmat(maxs,size(data,1),1))*(upper_bound-lower_bound); 0067 % where is this formulation from?? Result appearance? 0068 % Is it scaled to fit inside boundaries?