yes.. iam back. i have found absolute value for vectors by commanding abs.. now i could not do divide (n1.n2/|n1| |n2|)..

조회 수: 1 (최근 30일)
yes.. iam back. i have found absolute values for vectors by commanding abs.. now i could not do divide (n1.n2/|n1| n2)..

답변 (1개)

KSSV
KSSV 2017년 2월 2일
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
Jan
Jan 2017년 2월 2일
편집: Jan 2017년 2월 2일
@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)))
Ram kumar Masilamani
Ram kumar Masilamani 2017년 2월 3일
@jan: yeah its very hard to understand me. with your answer, I found the answer as follows. My huge doubt is that it is correct value of psi angle..?please leave a reply.. please x1=[6.630]; y1=[12.294]; z1=[-1.457]; x2=[7.613]; y2=[12.686]; z2=[-0.404]; x3=[8.324]; y3=[11.427]; z3=[0.102]; x4=[9.372]; y4=[11.018]; z4=[-0.564]; v1=[x2-x1, y2-y1, z2-z1]
v1 =
0.9830 0.3920 1.0530
v2=[x3-x2, y3-y2, z3-z2]
v2 =
0.7110 -1.2590 0.5060
v3=[x4-x3, y4-y3, z4-z3]
v3 =
1.0480 -0.4090 -0.6660
n1=cross(v1,v2)
n1 =
1.5241 0.2513 -1.5163
n2=cross(v2,v3)
n2 =
1.0454 1.0038 1.0286
x=cos(-1)
x =
0.5403
y=dot(n1,n2)
y =
0.2859
y1=(n1*n2.')
y1 =
0.2859
z=norm(n1).*norm(n2)
z =
3.8468
ans=x.*(y./z)
ans =
0.0402

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by