필터 지우기
필터 지우기

How to implement the Gaussian radial basis function in MATLAB ?

조회 수: 10 (최근 30일)
charu shree
charu shree 2023년 3월 20일
편집: Torsten 2023년 3월 21일
Hello all, I am dealing with the following optimization problem
where is a column vector of dimension , is also a column vector of dimension , is matrix of dimension , is row vector of and is the Gaussian radial basis function, where is the variance.
My query is how to code this Gaussian radial basis function (RBF) ?
Any help in this regard will be highly appreciated.

채택된 답변

Torsten
Torsten 2023년 3월 21일
편집: Torsten 2023년 3월 21일
Before you start the optimization, check whether K in your case is positive-definite.
Lt = 10;
p = rand(Lt,4);
sigma = 1.0;
for l = 1:Lt
for j = 1:Lt
K(l,j) = exp((norm(p(l,:)-p(j,:)))^2/(2*sigma^2));
end
end
K
K = 10×10
1.0000 1.0558 1.2332 1.1752 1.1144 1.7121 1.4345 1.4970 1.3174 1.4356 1.0558 1.0000 1.1059 1.1852 1.0453 1.4602 1.3978 1.2603 1.1884 1.3441 1.2332 1.1059 1.0000 1.4993 1.1769 1.7198 1.2359 1.2245 1.2960 1.8679 1.1752 1.1852 1.4993 1.0000 1.3279 1.1864 1.5427 1.3336 1.2247 1.0896 1.1144 1.0453 1.1769 1.3279 1.0000 1.6242 1.4504 1.5273 1.1608 1.4210 1.7121 1.4602 1.7198 1.1864 1.6242 1.0000 1.7290 1.2760 1.2118 1.1176 1.4345 1.3978 1.2359 1.5427 1.4504 1.7290 1.0000 1.5769 1.2315 1.9993 1.4970 1.2603 1.2245 1.3336 1.5273 1.2760 1.5769 1.0000 1.4254 1.5342 1.3174 1.1884 1.2960 1.2247 1.1608 1.2118 1.2315 1.4254 1.0000 1.2412 1.4356 1.3441 1.8679 1.0896 1.4210 1.1176 1.9993 1.5342 1.2412 1.0000
eig(K)
ans = 10×1
-1.7051 -0.8915 -0.6203 -0.3001 0.0081 0.0171 0.0346 0.0637 0.1039 13.2897
  댓글 수: 6
charu shree
charu shree 2023년 3월 21일
Ok....Thank you sir...
Torsten
Torsten 2023년 3월 21일
편집: Torsten 2023년 3월 21일
Thank you for the correction.
Is it somehow obvious that the matrix will be positive-definite ?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Matt J
Matt J 2023년 3월 21일
편집: Matt J 2023년 3월 21일
If you have the Statistics Toolbox, you can avoid a loop by using pdist2
Lt = 10;
p = rand(Lt,4);
sigma = 1.0;
K=exp(-pdist2(p,p).^2 / 2/sigma^2);

카테고리

Help CenterFile Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by