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??

 Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 11 Nov. 2014

0 Stimmen

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)));

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 11 Nov. 2014

Kommentiert:

am 11 Nov. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by