Looped vector calculation and storage of answer
Show older comments
Hello, I have two horizontal vectors which contain points for plotting a circle; vector "x" for x-coordinates and vector "y" for y-coordinates. I am trying to write a piece of code which will determine the largest chord within that circle. The approach I am taking is to use the distance formula (sqrt((x2-x1)^2)+((y2-y1)^2)) and calculate the distance between the first point and the rest - store all the distances. Then the distance between the second point and the rest - store all distance to same place. And continue this till the last point. In the end I shall have a vector (or matrix) which contains all these distances, I can then run a "max" command to find the maximum distance. I am just not sure how to implement this into MatLab, in a neat looped script. All and any help will be greatly appreciated.
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics 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!