Need help creating array for a large data set
Show older comments
Hi, im a few hours new to matlab, and have a pretty urgent question
How do i create an array of angles between 2 lines from an array of x-y points? i understand how to do it if i want to calculate of 3 points, but i have almost 1000 points to handle, and i can't simply define each line segment individually.
for an array A with 2 columns where first column denotes x axis and second denotes y axis, and A[1,1]= first point i figured i'll need to do something similar to define length
P_ij = sqrt[(A[i,1]-A[j,1])^2+(A[i,2]-A[j,2])^2]
to get an array of a two columns of where first column: j=i+1, second column: j=i+2.
but i dont know the commands to input the indices i&j and how to construct this array with the conditions needed.
from there as i need to determine the angle between each subsequent segment, i figured i would need to define
theta_k=Acos[(2P_k,k+1 P_k+1,k+2)^-1 *(P_k,k+2^2-P_k,k+1^2-P_k+1,k+2^2)]
but again, i don't know if i can even denote the k+2 k+1 elements properly to create this new single column array for the angles :/
i'm sorry if i'm being problematic, been watching alot of tutorials and searching through the internet but can't find anyway in which i can do this
Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!