How to use loop function for finding the several angles?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Akzeptierte Antwort
KSSV
am 1 Jul. 2016
clc; clear all ;
A = [10,10]; B = [5,60];
C1=[ 11.1902 78.9215
43.7123 84.8152
26.2182 55.0542
89.4285 18.3821
41.1215 32.8977
62.8533 101.3337
26.5649 25.2378
70.1982 92.5817
36.2971 63.8342
75.4079 109.6135] ;
ABC = zeros(size(C1,1),1) ;
for i = 1:size(C1,1)
C = C1(i,:) ;
x = [B(1) A(1) C(1)];
y = [B(2) A(2) C(2)];
x1 = x(1); y1 = y(1);
x2 = x(2); y2 = y(2);
x3 = x(3); y3 = y(3);
ang1 = atan2(abs(det([x1,x2,x3;y1,y2,y3;1,1,1])), ...
(x2-x1)*(x3-x1)+(y2-y1)*(y3-y1));
ABC(i) =180/pi*(ang1) ;% this is ABC angle
end
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements 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!