Mercurial > hg > mauch-mirex-2010
comparison _misc/general/.svn/text-base/qnormalise.m.svn-base @ 8:b5b38998ef3b
added all that other stuff
author | matthiasm |
---|---|
date | Fri, 11 Apr 2014 15:54:25 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
7:12abff5474c8 | 8:b5b38998ef3b |
---|---|
1 function [outmat, scale] = qnormalise(inmat, varargin) | |
2 % qnormalise(inmat, q, dim) returns the field inmat normalised by the q | |
3 % norm over dimension dim | |
4 dim = 1; | |
5 if nargin > 1 | |
6 q = varargin{1}; | |
7 if nargin > 2 | |
8 dim = varargin{2}; | |
9 end | |
10 else | |
11 q = 2; | |
12 end | |
13 sizeInmat = size(inmat); | |
14 nDim = length(sizeInmat); | |
15 repeatpattern = [ones(1,dim-1) sizeInmat(dim) ones(1,nDim-dim)]; | |
16 scale = qnorm(inmat, q, dim); | |
17 outmat = inmat ./ repmat(scale, repeatpattern); |