MATLAB Answers

Truss3 in Larrys Toolbox not returning an answer (NaN)

1 view (last 30 days)
I've been trying to get 'Larrys Toolbox' working after watching the introduction video on how to use it to solve for space frame trusses.
I have been able to run both the example files ('truss3ex.m' and 'truss3ex2.m') with no problems (beyond replacing a 'VIEW' with a 'view') however when I try and create a file to input my own geometry and loads the script will only partially complete. I have attached the files in question in a .zip.
When I run the files in the attached .zip, the script will output a graph of the undeformed geometry, Larrys Toolbox brads truss.jpg
but then it gives the following output:
>> brads_truss
Current plot held
Warning: System may be partially constrained.
> In truss3 (line 222)
In brads_truss (line 31)
Warning: Matrix is singular to working precision.
> In truss3 (line 224)
In brads_truss (line 31)
peak_klb =
162
maxMforce_klb =
NaN
maxDX_in =
NaN
maxDY_in =
NaN
maxDZ_in =
NaN
I'm not sure what 'NaN' means but the MATLAB documentation says it is the IEEE representation for 'not a number'.
This is the same with both my original 'brads_truss.m' file and the 'brads_truss_customary_units.m' file. The original file has SI units, while the second one is converted to U.S. customary units.
I've looked in the truss3.m file, but I cannot see any constants that could be removed or changed to account for the change from customary units to SI.
Does anyone know what I might be doing wrong?
*****************************************************************************************************************
MATLAB 'ver' info included below:
>> ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.5.0.1033004 (R2018b) Update 2
MATLAB License Number: nnnnnnn
Operating System: Microsoft Windows 10 Home Version 10.0 (Build 18362)
Java Version: Java 1.8.0_152-b16 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.5 (R2018b)
Simulink Version 9.2 (R2018b)
Computer Vision System Toolbox Version 8.2 (R2018b)
Control System Toolbox Version 10.5 (R2018b)
DSP System Toolbox Version 9.7 (R2018b)
Data Acquisition Toolbox Version 3.14 (R2018b)
Image Processing Toolbox Version 10.3 (R2018b)
Instrument Control Toolbox Version 3.14 (R2018b)
MATLAB Coder Version 4.1 (R2018b)
Optimization Toolbox Version 8.2 (R2018b)
Robotics System Toolbox Version 2.1 (R2018b)
Signal Processing Toolbox Version 8.1 (R2018b)
Simscape Version 4.5 (R2018b)
Simscape Multibody Version 6.0 (R2018b)
Simulink Control Design Version 5.2 (R2018b)
Statistics and Machine Learning Toolbox Version 11.4 (R2018b)
Symbolic Math Toolbox Version 8.2 (R2018b)
>>

  0 Comments

Sign in to comment.

Accepted Answer

Bradley Wilkinson
Bradley Wilkinson on 2 Oct 2019
Edited: Bradley Wilkinson on 2 Oct 2019
So I figured it out, the whole thing was working just as advertised, only I had incompletely triangulated the truss frame. So when the script tried to solve the problem, the whole frame collapsed as it still had degrees of freedom to move.
After Christophs suggestion to try simplifying the case to see if I could get it to work, I created a smaller truss frame with only two of the five frames, and associated reduced load case. It still failed part way through the solution but printed the undistorted truss anyway:
If you look at this frame, you will see that the node at 0,0,~300 is not constrained in the x-direction. Hence when we try to solve for this data set, the script returns a 'NaN' answer. This is because that node weeble-wobbles off into the distance as the whole frame collapses.
I added one extra frame member between the uncompletely restrained node and the node nearest to it in the x-direction. When we solve for the frame with the extra member included we see:
The undeformed truss and the deformed truss!
Now back to the original 4-bay frame with 4 off added members tying together the five affected nodes and the original loading case restored we see:
The complete frame in both distorted and undistorted shapes (note the 4 off extra members across the middle of the lower level of the frame compared to the picture in my original post).
So thank you to Christoph for your suggestion to try simplifying things to see if that showed the problem. Your prompt caused me to notice where the mistake in my frame was.
Cheers.
EDIT:
To solve for my original frame I probably need to learn how to use one of the other scripts in Larrys Toolbox, 'frame3.m'. This script has internal moments in the mebers, and hence could deal with a stiff joint in the noted locations and thus would not need the extra members.

  0 Comments

Sign in to comment.

More Answers (1)

Christoph Hahn
Christoph Hahn on 1 Oct 2019
Edited: Christoph Hahn on 1 Oct 2019
Hi Brad,
I am using here Larry's example 'truss3x2.m' for illustration purpose.
He uses 3 types of joints (one could also say nodes)
  • blue: joints are constrained in x,y,z. there are recation forces in x,y,z.
  • red: loads are introduced at these joints
  • green: joints are neither constrained nor loaded.
Note: Read the comments in 'truss3.m' to get all details how loads and boundary conditions can be introduced.
In your case, members and joints seem to be meaningful, because it can be plotted. Something seems to be messed up with the loads / boundary conditions -> so you need to look into defining forceJ carefully.
So, I suggest you start with a very simple case for forceJ such as depicted in the image. I used the same color scheme as in my example above.
Hope this helps.
Best, Christoph

  0 Comments

Sign in to comment.

Sign in to answer this question.