有谁可以在这个几何文件中解释这一行?

时间:2015-02-21 00:47:35

标签: matlab

我有这个几何文件,我不明白。任何人都可以解释这条线的作用吗?

             boundary = [0,0.25,0.5,0.75;
             0.25,0.5,0.75,1;
              1,1,1,1;
              0,0,0,0];
             varargout{1} = boundary(:,bs);

我需要修改这个文件,以便我替换striaght线,用曲线表示边缘,但首先我需要了解每条线的含义..这是m.file谢谢

function varargout = rechteckgeometrie(varargin)

  length = 0.05315;
  length2 = 0.07;
  width = 0.575;

  switch nargin
   case 0
    varargout{1} = 4;
  case 1
    bs = varargin{1};
    boundary = [0,0.25,0.5,0.75;
                0.25,0.5,0.75,1;
                1,1,1,1;
                0,0,0,0];
    varargout{1} = boundary(:,bs);
case 2
    if isempty(varargin{1}) && isempty(varargin{2})
        varargout{1,2} = [];
    else
        bs = varargin{1};
        s = varargin{2};

       boundary = [0,width,width,0,0;
           0,0,length2,length,0];

        varargout{1} = (bs-4*s).*reshape(boundary(1,bs),size(bs))+...
            (4*s+1-bs).*reshape(boundary(1,bs+1),size(bs));
        varargout{2} = (bs-4*s).*reshape(boundary(2,bs),size(bs))+...
            (4*s+1-bs).*reshape(boundary(2,bs+1),size(bs));       
    end
otherwise
    disp('Wrong number of input arguments');
end
%-----------------
figure; clf;
pdegplot('rechteckgeometrie', 'edgeLabels', 'on');

1 个答案:

答案 0 :(得分:0)

第一个语句将指定了16个值的4x4矩阵分配给名为boundary的变量。

第二个语句(varargout{1} = boundary(:,bs);)将rechteckgeometrie的返回值设置为bs的{​​{1}} th 列。