%3B. function to normalize data by arithmetic mean % normalization factors here are relative to the mean of all % spiked control signals function normalized_data = AM_normalize(unnorm_data,missing_data,num_controls) [num_rows, num_expt] = size(unnorm_data); %find mean of all control signals mean_controls = mean(mean(unnorm_data(1:num_controls,:))); %calculate the ratio of each control to the mean control signal control_ratios = mean(unnorm_data)./repmat(mean_controls,1,num_expt); %normalize the data normalized_data = unnorm_data./repmat(control_ratios,num_rows,1); %set all missing values back to -1000 normalized_data(missing_data) = -1000; return