find the angles of a triangle given double coordinates
    6 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Lev Mihailov
 el 11 de Abr. de 2022
  
    
    
    
    
    Respondida: Star Strider
      
      
 el 11 de Abr. de 2022
            I am given 3 double coordinates, using them I need to find the angle (cosine and sine) of the triangle
a1=1.49895;
a2=2.62186;
b1=1.49747;
b2=2.62186;
c1=1.49747;
c2=2.62471;
Thanks in advance
1 comentario
  Dyuman Joshi
      
      
 el 11 de Abr. de 2022
				FIrst of all, this question doesn't have anything to do with MATLAB. It's a simple mathematics problemand looks like a homework question/assignment.
Second, even doing a quick google search would have helped you.
Respuesta aceptada
  Star Strider
      
      
 el 11 de Abr. de 2022
        One approach, based on code I wrote for a different Answer — 
a1=1.49895;
a2=2.62186;
b1=1.49747;
b2=2.62186;
c1=1.49747;
c2=2.62471;
X_Val = [a1; b1; c1];
Y_Val = [a2; b2; c2];
polygon = polyshape(X_Val, Y_Val);
V = [X_Val Y_Val];
V = [V(end,:); V; V(1,:)];
for k = 2:size(V,1)-1
    anglr(:,k-1) = [(atan2(V(k-1,2)-V(k,2), V(k-1,1)-V(k,1))); (atan2(V(k+1,2)-V(k,2), V(k+1,1)-V(k,1)))];  % Calculate Radian Angles
    angld(:,k-1) = rad2deg(anglr(:,k-1));                                                                   % Convert To Degrees
    anglrinc(k-1) = mod(diff(anglr(:,k-1))-pi,pi);                                                      % Reduce Radian Angles
    angldinc(k-1) = mod(diff(angld(:,k-1))-180,180);                                                        % Reduce Degree Angles
end
figure
plot(polygon)
hold on
% plot(X_Val, Y_Val, 'p')
hold off
grid
axis('equal')
text(X_Val, Y_Val, compose('\\angle%d = %.1f°',[1:size(X_Val,1); angldinc].'))
Check = sum(angldinc)
.
0 comentarios
Más respuestas (1)
  Walter Roberson
      
      
 el 11 de Abr. de 2022
        The second output of the boundary() function is the area of the enclosed polygon.
0 comentarios
Ver también
Categorías
				Más información sobre Logical en Help Center y File Exchange.
			
	Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




