Mercurial > hg > mauch-mirex-2010
annotate _misc/general/qnormalise.m @ 9:4ea6619cb3f5 tip
removed log files
author | matthiasm |
---|---|
date | Fri, 11 Apr 2014 15:55:11 +0100 |
parents | b5b38998ef3b |
children |
rev | line source |
---|---|
matthiasm@8 | 1 function [outmat, scale] = qnormalise(inmat, varargin) |
matthiasm@8 | 2 % qnormalise(inmat, q, dim) returns the field inmat normalised by the q |
matthiasm@8 | 3 % norm over dimension dim |
matthiasm@8 | 4 dim = 1; |
matthiasm@8 | 5 if nargin > 1 |
matthiasm@8 | 6 q = varargin{1}; |
matthiasm@8 | 7 if nargin > 2 |
matthiasm@8 | 8 dim = varargin{2}; |
matthiasm@8 | 9 end |
matthiasm@8 | 10 else |
matthiasm@8 | 11 q = 2; |
matthiasm@8 | 12 end |
matthiasm@8 | 13 sizeInmat = size(inmat); |
matthiasm@8 | 14 nDim = length(sizeInmat); |
matthiasm@8 | 15 repeatpattern = [ones(1,dim-1) sizeInmat(dim) ones(1,nDim-dim)]; |
matthiasm@8 | 16 scale = qnorm(inmat, q, dim); |
matthiasm@8 | 17 outmat = inmat ./ repmat(scale, repeatpattern); |