Skip to main content

normalizeSynergiesByMaximumWeight.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% This function normalizes synergies by dividing each synergy weight vector
% by its maximum value and multiplying each weight vector's corresponding
% synergy commands by the same value. This does not change the calculated
% activations, but the weight vectors may be more easily plotted and
% interpreted.
%
% (Array of double, Array of double) -> (Array of double, Array of double)
% Normalizes synergies by maximum synergy weight


function [synergyWeights, synergyCommands] = ...
normalizeSynergiesByMaximumWeight(synergyWeights, synergyCommands)
scaleFactors = max(synergyWeights')';
synergyWeights = synergyWeights ./ scaleFactors;
synergyCommands = synergyCommands .* permute(scaleFactors, [3 2 1]);
end