欢迎来到本博客 ❤️ ❤️
博主优势: 博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。
⛳ 座右铭:行百里者,半于九十。
本文目录如下:
本代码说明了“最小二乘支持向量机”在学习偏微分方程 (PDE) 解方面的应用。提供了一个示例,并将获得的结果与精确的解决方案进行比较。
部分代码:
clc; clear all; close all
warning('off','all')
a0=0;
b0=1;
n=11;
h=(b0-a0)/n;
[X1,Y1]=meshgrid(a0+h:h:b0-h);
W=[];
for i=1:size(X1,2)
Z=[X1(:,i),Y1(:,1)];
W=[W ; Z];
end
subplot(2,3,1)
plot(W(:,1),W(:,2),'o')
hold on
[X,Y]=meshgrid(a0:h:b0);
W2=[];
for i=1:size(X,2)
Z=[X(:,i),Y(:,1)];
W2=[W2 ; Z];
end
L1=[];
for i=1:n+1
L1=[L1 ; W2(i,:)];
end
L2=[];
for i=n*(n+1)+1:size(W2,1)
L2=[L2 ; W2(i,:)];
end
L3=[L1(:,2) L1(:,1)];
L4=[L2(:,2) L2(:,1)];
plot(L1(:,1),L1(:,2),'s')
plot(L2(:,1),L2(:,2),'o')
plot(L3(:,1),L3(:,2),'p')
plot(L4(:,1),L4(:,2),'+')
title('Training points','Fontsize',14)
xlabel('x')
ylabel('y')
%%
f=@(s,v) exp(-s).*(s-2+v.^3+6*v); % right hand side of the given PDE
gamma=10^14; % the regularization parameter
sig=0.95; % kernel bandwidth
K=KernelMatrix(W,'RBF_kernel',sig);
x=W(:,1);
y=W(:,2);
xx1=x*ones(1,size(x,1));
xx2=x*ones(1,size(x,1));
cof1=2*(xx1-xx2')/(sig);
xx3=y*ones(1,size(y,1));
xx4=y*ones(1,size(y,1));
cof2=2*(xx3-xx4')/(sig);
Kxx=(-2/sig)*K + (cof1.^2) .* K;
Kyy=(-2/sig)*K + (cof2.^2) .* K;
Kx2x2=( ( 12/(sig^2) - (12/sig)* (cof1.^2) + (cof1.^4) ) .*K);
Ky2y2=( ( 12/(sig^2) - (12/sig)* (cof2.^2) + (cof2.^4) ) .*K);
Kx2y2=( ( 4/(sig^2) - (2/sig)* (cof1.^2) - (2/sig)* (cof2.^2) + (cof1.^2).*(cof2.^2) ) .*K);
Ky2x2=( ( 4/(sig^2) - (2/sig)* (cof1.^2) - (2/sig)* (cof2.^2) + (cof1.^2).*(cof2.^2) ) .*K);
部分理论来源于网络,如有侵权请联系删除。
[1] Mehrkanoon S., Falck T., Suykens J.A.K., "Approximate Solutions to Ordinary Differential Equations Using Least Squares Support Vector Machines",IEEE Transactions on Neural Networks and Learning Systems, vol. 23, no. 9, Sep. 2012, pp. 1356-1367.
[2] Mehrkanoon S., Suykens J.A.K.,"LS-SVM approximate solution to linear time varying descriptor systems", Automatica, vol. 48, no. 10, Oct. 2012, pp. 2502-2511.
[3] Mehrkanoon S., Suykens J.A.K., "Learning Solutions to Partial Differential Equations using LS-SVM",Neurocomputing, vol. 159, Mar. 2015, pp. 105-116.