How to use loop function for finding the several angles?

2 次查看(过去 30 天)
Sorry

采纳的回答

KSSV
KSSV 2016-7-1
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 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by