hi,i was recently introduced in matlab and i face some difficulties,i have to calculate the dot product of three vectors a[4,7], b[6,8] and c [3,12] which form a triangle and then find the angle between them and also the area of the triangle.Could you please give me some ideas??

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2014년 11월 11일

0 개 추천

a = [4,7,0], b = [6,8,0] , c = [3,12,0]
v = [a;b;c]';
v3 = diff([v,v(:,1)],1,2);
ii = [1:3;rem(1:3,3)+1];
l0 = sqrt(sum(v3.^2)));
angles = pi-acos(sum(prod(reshape(v3(:,ii),[3 3 2]),3))./prod(l0(ii)));
Sarea = 1/2*norm(cross(v3(:,1),v3(:,2)));

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2014년 11월 11일

댓글:

2014년 11월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by