function answer = RBFGaussKernelFunc(x, c, sigema)
% param : x 表示要求的RBF核距离的向量
% param : c 表示RBF函数的样本中心向量
% param : sigema 表示Kernel函数需要的参数 K(x,y) = exp(-||x-y||^2 /sigema^2)
% function : 该函数的功能是实现对x向量求RBF距离
% CopyRight : edu.nust.cs726.JunH(111060881)
[xh xl] = size(x);
[ch cl] = size(c);
if xh~=ch || xl~=cl
error('the x vector is not the same size with c vector!');
end
if 1==xh
Odis2 = (x-c)*(x-c)';
elseif 1==xl
Odis2 = (x-c)'*(x-c);
else
error('x c is not vector');
end
answer = exp(- Odis2 / (sigema*sigema));
% param : x 表示要求的RBF核距离的向量
% param : c 表示RBF函数的样本中心向量
% param : sigema 表示Kernel函数需要的参数 K(x,y) = exp(-||x-y||^2 /sigema^2)
% function : 该函数的功能是实现对x向量求RBF距离
% CopyRight : edu.nust.cs726.JunH(111060881)
[xh xl] = size(x);
[ch cl] = size(c);
if xh~=ch || xl~=cl
error('the x vector is not the same size with c vector!');
end
if 1==xh
Odis2 = (x-c)*(x-c)';
elseif 1==xl
Odis2 = (x-c)'*(x-c);
else
error('x c is not vector');
end
answer = exp(- Odis2 / (sigema*sigema));
本文详细介绍了如何使用MATLAB实现径向基函数(RBF)核距离计算,包括输入参数的验证、计算距离矩阵和应用指数函数计算核值。
8943

被折叠的 条评论
为什么被折叠?



