Effacer les filtres
Effacer les filtres

Can anyone help me to apply RBF kernel function in matlab and how to write its equation?

33 vues (au cours des 30 derniers jours)
The equation is K(X,X') = exp(-||X-X'||2/2sigma2). Any help is appreciated

Réponse acceptée

the cyclist
the cyclist le 10 Mai 2021
Modifié(e) : the cyclist le 10 Mai 2021
% 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])
ans = 0.0439
(I think I got the norm part coded right, but you should double-check that because I didn't.)

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by