I'm trying to find a way to plot a truss in MATLAB, I can do it by using an adjacency matrix and the gplot function, but its very long winded approach especially if there are a lot of nodes connected to one another. Is there a faster way to do this?
MATLAB and gplot
3.1k Views Asked by JPC At
2
There are 2 best solutions below
0
On
If this is a truss in the Mechanics of Materials sense:
http://www.mathworks.com/matlabcentral/fileexchange/2170-mastering-mechanics-1-using-matlab-5
and the supporting book
http://www.amazon.com/Mastering-Mechanics-Using-MATLAB-Materials/dp/0138640343
I wrote some truss visualization and just general strength of material stuff into this.
I think gplot is a good function to plot a truss. However, it might be possible to simplify the creation of the adjacency matrix.
For example, if your
coordinatesare stored in a n-by-2 array, and there is a strut for every pair of nodes that is separated by less thandMax, you can create the adjacency matrix like this: