-
Notifications
You must be signed in to change notification settings - Fork 4
/
corrvc.m
35 lines (32 loc) · 942 Bytes
/
corrvc.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function [output] = corrvc(vc)
% corrvc
%
% Purpose: Computes a correlation matrix from a
% variance-covariance matrix.
%
% Format: cx = corrvc(vc);
%
% Input: vc KxK variance-covariance matrix (of data or parameters).
%
% Output: cx KxK correlation matrix.
% Check for complex input */
if isreal(vc) == 0;
error('ERROR: Not implemented for complex arguments.')
end
std = sqrt(diag(vc));
% if (type(vc) == 6);
output = vc./(std*std');
% elseif (type(vc) == 21);
% dims = getdims(vc);
% if (dims < 3);
% vc = arraytomat(vc);
% std = arraytomat(std);
% output = mattoarray(vc./(std.*std'));
% else
% torders = seqa(1,1,dims-2);
% torders = torders||dims||dims-1;
% output = vc./(std.*atranspose(std,torders));
% end
% else
% error('ERROR: Type mismatch.')
% end