MATLAB Spliting a line segment into desired length segments (Matlab)

AI Thread Summary
The discussion focuses on splitting line segments of varying lengths into equal minor segments using MATLAB. The user seeks a method to ensure that all minor segments have the same length, regardless of the total number of segments created. Suggestions include calculating the number of minor segments by dividing the major segment length by the desired minor length and utilizing MATLAB functions like 'linspace' or the colon operator for coordinate generation. The user emphasizes that not all of the major segment's length needs to be utilized. The conversation highlights the need for precise control over segment lengths in MATLAB programming.
mushi
Messages
23
Reaction score
0
Hi Guys,

I don't know if I make sense but please try to help me.

I am working in Matlab. I have multiple line segments of different lengths with end point coordinates. I want to split each major segment into multiple minor segments in a way that all segments will have same length. 'linspace' can only control number of segments regardless of their lengths. For me, number of segments are not important, but their lenghts are important (must be equal). I want their coordinates like 'linespace' does. It is not necessary that the full length of all segments will be utilized.

For example:
I have Major segments of:
(1) 3KM (2) 5KM (3) 12KM (with their end points)

I want to get:
I want to divide each major segment into multiple minor segments (say 2.5 KM each) with their coordinates.

Any help will be greatly appreciated.

Mushi
 
Physics news on Phys.org
What is a line segment? Can you give an example of your code?
 
calculate n by dividing the major segment length by the minor length, then use linspace
or
use the colon operator ... 0:2.5:12
 
Back
Top