yes.. iam back. i have found absolute value for vectors by commanding abs.. now i could not do divide (n1.n2/|n1| |n2|)..
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
yes.. iam back. i have found absolute values for vectors by commanding abs.. now i could not do divide (n1.n2/|n1| n2)..
0 Kommentare
Antworten (1)
KSSV
am 2 Feb. 2017
abs gives you +ve value. In your case what you have to use is norm. If I am not mistaken n1 stand for norm/ magnitude of the vector. You have to follow as below:
n1 = rand(1,10) ;
n2 = rand(1,10) ;
iwant = n1*n2'/(norm(n1)*norm(n2))
5 Kommentare
Jan
am 2 Feb. 2017
Bearbeitet: Jan
am 2 Feb. 2017
@Ram: It is hard to guess, what you are asking for. Explicit examples would be useful. KSSV's code cannot create an output like "(2.22, .2333, 0.322)", therefore I'm not sure, what this means. Perhaps you want:
Result = acosd((n1 * n2.') / (norm(n1) * norm(n2)))
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!