《基于视频的电熔镁炉工况识别系统→4.基于子空间角度的核函数→2.四种距离》
calculateMetricLDS.m
- input:_n=20_nv=1_724.mat 724个视频的 A B C X C0=Ymean=w[k] Q + 距离序号
![paste-125138167136259.jpg](http://pfyidw7py.bkt.clouddn.com/paste-125138167136259.jpg)
- output:dist 距离矩阵
- 调用subspaceAnglesAR.m进行子空间角度计算 参考见基于视频的电熔镁炉工况识别系统→4.基于子空间角度的核函数→1.子空间角度
- 调用plotDistance.m绘制距离矩阵
- 被kernal_matrix.m脚本调用
距离公式 | 代码 |
---|
- FinslerDistance
| angles的维数是 n(状态维数)*video_num(视频个数)*video_num
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
N = size(angles,2);
dist = zeros(N,N);
if N > 1
for i = 1:N
for j=1:i-1
dist(i,j) = max(angles(:,i,j));
end
end
dist = dist + dist';
else
dist = max(angles);
end
|
|
- MartinDistance
图
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
N = size(angles,2);
dist = zeros(N,N);
if N > 1%这样的循环就不计算主对角线上的元素了
for i = 1:N
for j = 1:i-1
dist(i,j) = sqrt(-sum(log(cos(angles(:,i,j)).^2)));
end
end
dist = dist + dist';
else
dist = sqrt(-sum(log(cos(angles).^2)));
end
|
|
- GapDistance
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
N = size(angles,2);
dist = zeros(N,N);
if N > 1
for i = 1:N
for j=1:i-1
dist(i,j) = sin(max(angles(:,i,j)));
end
end
dist = dist + dist';
else
dist = sin(max(angles));
end
|
|
- Frobenius
图
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
N = size(angles,2);
dist = zeros(N,N);
if N > 1
for i = 1:N
for j=1:i-1
dist(i,j) = sqrt(2*sum(sin(angles(:,i,j)).^2));
end
end
dist = dist + dist';
else
dist = sqrt(2*sum(sin(angles).^2));
end
|
|