Can anyone help me to apply RBF kernel function in matlab and how to write its equation?
15 次查看(过去 30 天)
显示 更早的评论
The equation is K(X,X') = exp(-||X-X'||2/2sigma2). Any help is appreciated
0 个评论
采纳的回答
the cyclist
2021-5-10
编辑:the cyclist
2021-5-10
% Define sigma
sigma = 0.4;
% Define the function
K = @(x1,x2) exp(-sum((x1-x2).^2)./(2.*sigma.^2));
% Apply the function to two vectors
K([1; 2; 3],[1; 2; 4])
(I think I got the norm part coded right, but you should double-check that because I didn't.)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!