📄 stencilr2q.m
字号:
function [StencilQ, CenterQ] = stencilR2Q(Stencil, Center)%------------------------------------------------------------------------------%% This function transforms a stencil on an ordinary rectangular grid into a % corresponding stencil on a quincunx grid.%% Stencil = input stencil%% Center = center of Stencil%% StencilQ = output stencil at quincunx grid%% CenterQ = center of StencilQ%% See also: stencilUPSaVC%% Design and implementation by:% Dr. Paul M. de Zeeuw <Paul.de.Zeeuw@cwi.nl> http://homepages.cwi.nl/~pauldz/% Last Revision: November 20, 2000.% Copyright 1999-2002 Stichting CWI, Amsterdam.%------------------------------------------------------------------------------o=[0 0];if ~all(size(o) == size(Center)) error(' stencilR2Q - unexpected dimensions of Center ')else clear o;end[n, m] = size(Stencil);CenterQ = [(Center(1)-Center(2)+m) (Center(1)+Center(2)-1)];nQ = n+m-1;StencilQ = reshape(linspace(0,0,nQ*nQ),nQ,nQ);for i=1:n for j=1:m StencilQ(i-j+m, i+j-1) = Stencil(i, j); endend%------------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -