Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Using ginput or related fuction to "connect the dots"

Subject: Using ginput or related fuction to "connect the dots"

From: Gerrit Grundling

Date: 24 May, 2010 19:30:20

Message: 1 of 3

I have a problem that is really important to all my work.

If I were to design, say, a space truss in three dimensions, the smallest number of inputs would be the coordinates of the nodes. I would like to then plot these nodes in two or three dimensions, depending on which allows for the most clarity, and specify the connected elements by clicking on the first node (or close enough to it to make something like magnetinput work) and on the second node. This way there will be no argument regarding the element connectivity, and Matlab can sort out the assembly matrix required to construct the best-possible conditioned elasticity matrix.

I would also like to be able to click and drag, say, points on a curve/spline to customise or modify aerofoils/torque vs speed curves etc.

Which functions already allow this, or how should I code my own?

For what it's worth, I am a newb to programming in Matlab.

Subject: Using ginput or related fuction to "connect the dots"

From: Sean

Date: 25 May, 2010 12:12:04

Message: 2 of 3

"Gerrit Grundling" <totallyplanecrazy@gmail.com> wrote in message <htek4c$f42$1@fred.mathworks.com>...
> I have a problem that is really important to all my work.
>
> If I were to design, say, a space truss in three dimensions, the smallest number of inputs would be the coordinates of the nodes. I would like to then plot these nodes in two or three dimensions, depending on which allows for the most clarity, and specify the connected elements by clicking on the first node (or close enough to it to make something like magnetinput work) and on the second node. This way there will be no argument regarding the element connectivity, and Matlab can sort out the assembly matrix required to construct the best-possible conditioned elasticity matrix.
>
> I would also like to be able to click and drag, say, points on a curve/spline to customise or modify aerofoils/torque vs speed curves etc.
>
> Which functions already allow this, or how should I code my own?
>
> For what it's worth, I am a newb to programming in Matlab.


We had a similar project and instead of making an interactive gui just had a second [nx2] matrix of connectivities. Then using line() with the connectivities and the nodes we could verify everything was correct. You also would have to have a list of fixed degrees of freedom for the purpose of making a non-singular stiffness matrix. The list of connectivities is also important for assembling the stiffness matrix so that any local/global transformations can be calculated and so the program can know what columns/rows to add the stiffness components.

If I were you, especially as a newbie, I would write the programs to draw a truss given a list of nodes boundaries and connectivities and solve based on another applied force vector. Then worry about the interactive gui later.

Your second question:
If you're going to be using a curve/spline, and everything above is working; it is fairly trivial to implement a function to calculate the node locations and corresponding connectivities/boundary conditions. One generalized this can take in any number of nodes you want giving you a very accurate approximation. Once again, I would recommend solving this problem without the gui first.

Good Luck!

Subject: Using ginput or related fuction to "connect the dots"

From: Gerrit Grundling

Date: 25 May, 2010 15:54:09

Message: 3 of 3

"Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <htgeqk$ftd$1@fred.mathworks.com>...
> "Gerrit Grundling" <totallyplanecrazy@gmail.com> wrote in message <htek4c$f42$1@fred.mathworks.com>...
> > I have a problem that is really important to all my work.
> >
> > If I were to design, say, a space truss in three dimensions, the smallest number of inputs would be the coordinates of the nodes. I would like to then plot these nodes in two or three dimensions, depending on which allows for the most clarity, and specify the connected elements by clicking on the first node (or close enough to it to make something like magnetinput work) and on the second node. This way there will be no argument regarding the element connectivity, and Matlab can sort out the assembly matrix required to construct the best-possible conditioned elasticity matrix.
> >
> > I would also like to be able to click and drag, say, points on a curve/spline to customise or modify aerofoils/torque vs speed curves etc.
> >
> > Which functions already allow this, or how should I code my own?
> >
> > For what it's worth, I am a newb to programming in Matlab.
>
>
> We had a similar project and instead of making an interactive gui just had a second [nx2] matrix of connectivities. Then using line() with the connectivities and the nodes we could verify everything was correct. You also would have to have a list of fixed degrees of freedom for the purpose of making a non-singular stiffness matrix. The list of connectivities is also important for assembling the stiffness matrix so that any local/global transformations can be calculated and so the program can know what columns/rows to add the stiffness components.
>
> If I were you, especially as a newbie, I would write the programs to draw a truss given a list of nodes boundaries and connectivities and solve based on another applied force vector. Then worry about the interactive gui later.
>
> Your second question:
> If you're going to be using a curve/spline, and everything above is working; it is fairly trivial to implement a function to calculate the node locations and corresponding connectivities/boundary conditions. One generalized this can take in any number of nodes you want giving you a very accurate approximation. Once again, I would recommend solving this problem without the gui first.
>
> Good Luck!

I have traditionally assembled the trusses as you suggest, and the truss program works. You try such a procedure for 120 nodes and 360 elements the old-fashioned way and see how long it takes.

I need a more time-effective method than this. As for click-and-drag operations, that is the only improvement I need to make to my programs using spline-fitting to points. It's not about beauty, it's about efficiency.

Having said that, I thank you for your swift response and valid comments. As far as the programming goes, I have had exposure to MATLAB and have coded, amongst others, a low-speed aerodynamic solver (not that I'd recommend mine over others'), I am just not completely confident in myself. Nothing like a bit of pressure to inspire courage, or is it arrogance...? Don't answer that.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us