To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

The primary repository for this project is hosted at git://github.com/rmeddis/MAP.git .
This repository is a read-only copy which is updated automatically every hour.

Statistics Download as Zip
| Branch: | Revision:

root / utilities / UTIL_vectorStrength.m @ 33:161913b595ae

History | View | Annotate | Download (869 Bytes)

1
function VS=UTIL_vectorStrength(PH)
2
% UTIL_vectorStrength converts a period histogram to a vector strength measure.
3
% **************
4
% using the Johnson(1980) formula.
5
% usage:
6
% 	VS=UTIL_vectorStrength(PH);
7
%
8
% Input arguments:
9
% 	PH is channels x  period histogram matrix
10
%
11
% Output argumkents:
12
% VS is a column of vector strengths, one per channel
13
[numChannels K]=size(PH);
14

    
15
% a=cos(2*pi*(1/K:1/K:1));
16
% b=sin(2*pi*(1/K:1/K:1));
17
% VS=(sum(PH.*repmat(a,numChannels,1),2).^2 + sum(PH.*repmat(b,numChannels,1),2).^2).^0.5;
18
% warning off MATLAB:divideByZero
19
% VS=VS./sum(PH,2);
20
% warning on MATLAB:divideByZeroa=cos(2*pi*(1/K:1/K:1));
21

    
22

    
23
a=cos(2*pi*(1/K:1/K:1));
24
b=sin(2*pi*(1/K:1/K:1));
25
N=sum(PH,2);
26
warning off MATLAB:divideByZero
27
VS=((sum(PH.*repmat(a,numChannels,1),2)./N).^2 ...
28
    + (sum(PH.*repmat(b,numChannels,1),2)./N).^2).^0.5;
29
warning on MATLAB:divideByZero