CALCULATE norms: l2 and l1 distances

13 ビュー (過去 30 日間)
long le
long le 2020 年 10 月 30 日
回答済み: Mayank Bajpai 2020 年 10 月 30 日
I have two vector with different size
x=[1; 2; 5; 6; 1; 9; -5 ];
y=[1; -2; 3; 1; 0; -3 ];
How can I calculate the distance l1, l2 between x vs x, and x vs y?

回答 (1 件)

Mayank Bajpai
Mayank Bajpai 2020 年 10 月 30 日
L1 norm: norm(v,1)
L2 norm: norm(v,2)
norm between a and b: norm((b-a),p) where p can be 1,2 or inf.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by