⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alt.m

📁 本代码为基于matlab的求解偏微分方程的利用径向基函数的无网格方法的源码
💻 M
字号:
% This is the test driver for the potential collocation problem.% Not yet finished, work in progress.
%Before starting this program, please run Collocation.m to define the global% variables %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%       
if RBFdomain==7    domaincreator    intpoints=[intpoints;bndpoints];elsebndpoints=regbndpointsRO(RBFstepsize);    % generate boundary points 
                                    % generate interior points,intpoints=[regintpointsRO(RBFstepsize) ; bndpoints]; % use boundary points also as "interior"
end;figure(2) ; % plot points, for checking
plot(intpoints(:,1),intpoints(:,2),'.')
axis equal
hold on
plot(bndpoints(:,1),bndpoints(:,2),'O');title('Collocation Points');hold off;[nint,nintdim]=size(intpoints);intvalues=zeros(nint,1);
  % rhs values in interior
bndvalues=fct2D(bndpoints(:,1),bndpoints(:,2));         % rhs values on baiundary

result = rbfLapsolvecond (intpoints, intvalues, bndpoints, bndvalues); % now test the solver

coeff=result{1};
condition=result{2};handel=findobj('Tag','text3');set(handel,'String',['Condition of matrix: ',num2str(condition)]);
% now evaluate the solution at given boundary points, data must be reproduced  
bndrepvalues = rbfPeval (bndpoints, intpoints, bndpoints, coeff);
bnderrnorm=max(bndrepvalues-bndvalues); % should be small
handel=findobj('Tag','text4');set(handel,'String',['largest error at boundary collocation  points: ',num2str(bnderrnorm)]);

figure(3)   % now test for some more boundary pointsclaif RBFdomain==7    bndtestpoints=onpolygon(RBFstepsize.*0.05,vertex);else
bndtestpoints=regbndpoints(RBFstepsize.*0.05);end% generate test boundary points 
bndrepvalues = rbfPeval (bndtestpoints, intpoints, bndpoints, coeff);
plot(bndrepvalues-fct2D(bndtestpoints(:,1),bndtestpoints(:,2))); % plots error on boundary 

title('Error on boundary');hold off;
% now evaluate the Laplacian of the solution at given interior points, data must be reproduced  
intrepvalues = rbfLPeval (intpoints, intpoints, bndpoints, coeff);
interrnorm=max(intrepvalues-intvalues); % should be small
handel=findobj('Tag','text5');set(handel,'String',['largest error of the Laplacian at  interior  collocation points: ',num2str(bnderrnorm)]);

% now we evaluate the error on a fine grid 
np=3*ceil(2/RBFstepsize);
[X,Y]=meshgrid(-1:2/(np-1):1,-1:2/(np-1):1);
xr=reshape(X,[(np)*(np) 1]);
yr=reshape(Y,[(np)*(np) 1]);
datapoints=[xr yr];mask=maskdomain(X,Y);

figure(4) clatitle('the plot shows the  approximation');hold on
datarepvalues = rbfPeval (datapoints, intpoints, bndpoints, coeff);
errvalues=datarepvalues;
surfc(X,Y,mask.*reshape(errvalues,[np np]));
shading interp;
hold off
% now we evaluate the Laplacian error on a fine grid 
handel=findobj('Tag','text6');error=max(max(abs(mask.*reshape(errvalues,[np np]))));set(handel,'String',['largest    value of approximation  inside the domain   : ',num2str(error)]);

figure(5) clatitle('the plot shows: Laplace[approximation]');hold on
datarepvalues = rbfLPeval (datapoints, intpoints, bndpoints, coeff);
errvalues=datarepvalues;
surfc(X,Y,mask.*reshape(errvalues,[np np]));
shading interp;
handel=findobj('Tag','text7');error=max(max(abs(mask.*reshape(errvalues,[np np]))));set(handel,'String',['largest    value of Laplace(approximation)  inside the domain   : ',num2str(error)]);

hold off;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -