distLpNorm

Lp norm of a vector

Contents

Syntax

Description

out=distLpNorm(x, p) returns the Lp norm of a given vector x.

If x is a matrix, then Lp norm is applied to each column vector.

Example

vec=[3; 4];
fprintf('distLpNorm([3; 4], 1) = %f\n', distLpNorm(vec, 1));
fprintf('distLpNorm([3; 4], 2) = %f\n', distLpNorm(vec, 2));
fprintf('distLpNorm([3; 4], inf) = %f\n', distLpNorm(vec, inf));
distLpNorm([3; 4], 1) = 7.000000
distLpNorm([3; 4], 2) = 5.000000
distLpNorm([3; 4], inf) = 4.000000

Top page   Next: distLinScaling.m   Prev:distLpNormPairwise.m