yes.. iam back. i have found absolute value for vectors by commanding abs.. now i could not do divide (n1.n2/|n1| |n2|)..
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ram kumar Masilamani
el 2 de Feb. de 2017
Comentada: Ram kumar Masilamani
el 3 de Feb. de 2017
yes.. iam back. i have found absolute values for vectors by commanding abs.. now i could not do divide (n1.n2/|n1| n2)..
0 comentarios
Respuestas (1)
KSSV
el 2 de Feb. de 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 comentarios
Jan
el 2 de Feb. de 2017
Editada: Jan
el 2 de Feb. de 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)))
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!