Which loops and which co-ordinate system can I use to automate this example of a truss structure <p>I am completely new to matlab and can't seem to get an if loop to work. For example if Ln > k , plot point i(n-1) to i(n). How would I automatically assign the correct row or column vectors to i(n)?</p> <p>Here is a diagram of what I'm wanting</p> <p><img src="https://i.stack.imgur.com/T8WwD.jpg" alt="enter image description here"></p> <p>What I want to achieve is connect i(0) to i(1) to ... i(n-1) to i(n).</p> <p>I also am a bit confused at which co-ordinate system to use? I thought it would be easy to use a polar co-ordinate system. Defining a distance and angle from point i(o) and then doing the same from point i(1) but from what I could find, it is necessary to convert back to a cartesian co-ordinate system.</p> <p>Once I am comfortable with this section I am confident I can take on the next steps, and develop a full solution to my problem. If you are interested in what I am trying to achieve, here's a <a href="http://bit.ly/UtdzBZ" rel="nofollow noreferrer">link</a></p> <p>[PLEASE NOTE] In that question I linked to, I was told I made a mess of it. I'm sorry if this question is also not clear. I really have spent the time to make it as clear as possible. I find it hard to express myself sometimes.</p>