Compare two vectors for similarity
Ältere Kommentare anzeigen
How to compare two vectors quickly. Right now I print out each in a loop and examine them by eye, is there a way i can find if two are almost similar.
2 Kommentare
Souparno Bandyopadhyay
am 9 Dez. 2012
maxanto
am 2 Feb. 2022
isequal(a, b)
Returns true if each element of vector a is equal to each element of vector b. If some element of a are different from b returns false.
Akzeptierte Antwort
Weitere Antworten (1)
Greg Heath
am 10 Dez. 2012
14 Stimmen
S = sum(A-B) is NOT a useful function for quantifying similarity because positive and negative terms will cancel.
The most common are
mae(A-B) % mean(abs(A-B))
sae(A-B) % sum(abs(A-B))
norm(A-B,1) % sum(abs(A-B))
norm(A-B,inf) % max(abs(A-B))
mse(A-B) % mean((A-B).^2)
sse(A-B) % sum((A-B).^2)
norm(A-B) % sqrt(sse(A-B))
Hope this helps.
Thank you for formally accepting my answer
Greg
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!