but given a grain GOS is the average of the misorientation angles of points within it, see below (edit calcGrains)
% compute mean orientation and GOS
doMeanCalc = find(grains.grainSize>1 & grains.isIndexed);
for k = 1:numel(doMeanCalc)
qind = subSet(q,d(grainRange(doMeanCalc(k))+1:grainRange(doMeanCalc(k)+1)));
mq = mean(qind);
meanRotation = setSubSet(meanRotation,doMeanCalc(k),mq);
GOS(doMeanCalc(k)) = mean(angle(mq,qind));
end
And mis2mean is the misorientation angle of points within a grain to the average
% save
grains.prop.GOS = GOS;
grains.prop.meanRotation = reshape(meanRotation,[],1);
mis2mean = inv(rotation(q(:))) .* grains.prop.meanRotation(grainId(:));
end