PDIFF

Syntax: vout = PDIFF( v1, v2 )

The PDIFF positive difference function is an element by element function that requires two (2) arguments. The arguments can be scalars, vectors, matrices or tensors, but vectors, matrices and tensors cannot be mixed, and all arrays must be the same size. Scalar arguments result in a scalar. A vector argument result in a vector with the same length as the argument, and matrix (tensor) arguments result in a matrix (tensor) with the same dimensions as the arguments.

arg 1 arg 2  result  definition
scalarscalarscalar  PDIFF(a,b) = max( 0, a-b )
vectorvectorvector  PDIFF(x,y)[j] = max( 0, x[j]-y[j] )
scalarvectorvector  PDIFF(a,x)[j] = max( 0, a-x[j] )
vectorscalarvector  PDIFF(x,a)[j] = max( 0, x[j]-a )
matrixmatrixmatrix  PDIFF(m1,m2)[i,j] = max( 0, m1[i,j]-m2[i,j] )
scalarmatrixmatrix  PDIFF(a,m)[i,j] = max( 0, a-m[i,j] )
matrixscalarmatrix  PDIFF(m,a)[i,j] = max( 0, m[i,j]-a )

  MOD
  RAN