cosinedistance

It computes Cosine Distance between two vectors or matrices of same length. If one of the inputs has one row and the other has 'm' rows, then similarity is computed between one row and every other row.

Syntax

Distance = cosinedistance(X,Y)

Inputs

X
First input vector or matrix.
Type: double
Dimension: vector | matrix
Y
Second input vector or matrix.
Type: double
Dimension: vector | matrix

Outputs

Distance
The distance between two inputs.
Type: double
Dimension: vector | matrix

Example

Example of cosinedistance

x = [1, 2, 3];
y = [4, 5, 6];
distance = cosinedistance(x, y);
> distance
distance = 0.0253681538