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

📄 del2_5pt.m

📁 matlab 源代码,五点差分格式,可以直接运行,用于其他方面
💻 M
字号:
function [output]=del2_5pt(input,delx)
% DEL2_5PT ... compute the 5 point Laplacian
%
% [output]=del2_5pt(input,delx)
%
% DEL2_5PT computes the 5 point approximation to the laplacian operator of 
% the two dimensional matrix 'input'.  The horizontal and vertical bin
% spacing of the matrix MUST be the same.    
%x方向和z方向的空间采样率必须一致
% input = input matrix
% delx = the horizontal/ vertical bin spacing in consistent units%
% output = the output matrix

[nrows,ncolumns]=size(input);

input2=zeros(nrows+2,ncolumns+2);
input2(2:nrows+1,2:ncolumns+1)=input;
factor=1/(delx^2);
clear input


% for first dimension

   output = (input2(3:nrows+2,2:ncolumns+1) - 2.*input2(2:nrows+1,2:ncolumns+1) +...
                  input2(1:nrows,2:ncolumns+1))*factor;

% for second dimension 

 output = (input2(2:nrows+1,3:ncolumns+2) - 2.*input2(2:nrows+1,2:ncolumns+1) +...
                 input2(2:nrows+1,1:ncolumns))*factor+ output;

⌨️ 快捷键说明

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