Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/KPMstats/mkPolyFvec.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 function p = mkPolyFvec(x) | |
2 % MKPOLYFVEC Make feature vector by constructing 2nd order polynomial from input data | |
3 % function p = mkPolyFvec(x) | |
4 % | |
5 % x(:,i) for example i | |
6 % p(:,i) = [x(1,i) x(2,i) x(3,i) x(1,i)^2 x(2,i)^2 x(3,i)^2 .. | |
7 % x(1,i)*x(2,i) x(1,i)*x(3,i) x(2,i)*x(3,i)]' | |
8 % | |
9 % Example | |
10 % x = [4 5 6]' | |
11 % p = [4 5 6 16 25 36 20 24 30]' | |
12 | |
13 fvec = x; | |
14 fvecSq = x.*x; | |
15 [D N] = size(x); | |
16 fvecCross = zeros(D*(D-1)/2, N); | |
17 i = 1; | |
18 for d=1:D | |
19 for d2=d+1:D | |
20 fvecCross(i,:) = x(d,:) .* x(d2,:); | |
21 i = i + 1; | |
22 end | |
23 end | |
24 p = [fvec; fvecSq; fvecCross]; |