outer [matrix]
— Loadable Function: outer_product = outer (x,y)
— Loadable Function: outer_product = outer (x,y,@f)
— Loadable Function: outer_product = outer (x,y,"f\")

Returns the outer product of x and y. Both x and y must be vectors. outer returns a m-by-n matrix, where m is the length of x and n is the length of y.

If an optional third argument is supplied, it is used to define a function that is evaluated as f(x(i),y(j)) for the (i, j)-th element of return matrix. The function can be defined as a function handle, inline function or string and must accept two arguments with the second argument being a vector. If a function is not provided, '*' is used as the default. An example of the use of outer is

          outer([1.0 2.0 3.0],[2.0 3.0 4.0],@gcd)

which computes a 3-by-3 matrix with element element being the GCD of the corresponding x and y elements of the matrix