Neumann boundary condition

Discussion in 'Programmer's Corner' started by tojeena, Jul 30, 2012.

  1. tojeena

    Thread Starter Active Member

    May 2, 2009
    118
    0
    Could anyone please explain this matlab code...?
    function g = NeumannBoundCond(f)
    [nrow,ncol] = size(f);
    g = f;
    g([1 nrow],[1 ncol]) = g([3 nrow-2],[3 ncol-2]);
    g([1 nrow],2:end-1) = g([3 nrow-2],2:end-1);
    g(2:end-1,[1 ncol]) = g(2:end-1,[3 ncol-2]);
     
Loading...