Extract Mass & Stiffness Matrices from Nastran model

The punch file method may be used to extract the mass & stiffness matrices from Nastran models.  The format is awkward since zero terms are not stored.  Also the matrices are assumed to be symmetric, and the upper triangular portion above the diagonal is not stored.

Here is a paper from the Middle East Technical University which explains the format:  paper link.

The key is to apply the following command in the *.nas, *.dat, *.bdf or equivalent file:


Here is a sample file for a fixed-free beam, aluminum, 24 inch long, solid cylinder, 0.25 inch diameter, 24 elements:  beam_24e_diam_0p25_punch-000.nas

Its punch file output is:  beam_24e_diam_0p25_punch-000.pch

The fundamental frequency is 11.9 Hz.

If Femap is used, select the punch output with coupled mass.

Here is a C++ program which converts the punch file into full mass & stiffness matrices in ASCII text format:



The mass & stiffness matrices can then be imported to Excel, Matlab or some other program.

– Tom Irvine

Transverse Vibration of a Rotating Beam via the Finite Element Method


A function for calculating the natural frequencies and mode shapes for an elastic beam undergoing rotation is given in:

Matlab script: Vibrationdata Signal Analysis Package

The function can be accessed via:

>> vibrationdata > Miscellaneous > Structural Dynamics > Beam Bending > Rotating Beam, FEA

An option is included for calculating the response to a uniform force/length.

* * *

See also:  Beam_FEM_rotating.pdf

– Tom Irvine

Beam Supported by End Springs

A function for calculating the natural frequencies and mode shapes for an elastic beam supported by end springs is included in:

Matlab script: Vibrationdata Signal Analysis Package

The function can be accessed via:

>> vibrationdata > Miscellaneous > Structural Dynamics > Beam Bending > Beam with End Springs, FEA

Options for calculating the beam response to an applied force will be added soon.

* * *

See also:  Beam Bending Finite Element Analysis

– Tom Irvine

Rectangular Plate Bending Frequencies and Mode Shapes, Finite Element Method, GUI version


I have added a feature for rectangular plate bending modes to the Matlab GUI package.

Matlab script: Vibrationdata Signal Analysis Package

The script allows for the addition of point masses and point constraints.  This is a work-in-progress.  The next step will be to add base excitation options.

The new feature can be accessed via:

vibrationdata > Miscellaneous > Structural Dynamics > Plates, Rectangular & Circular > Rectangular Plate, Finite Element Method

* * *

Here is a reference paper: FEA_plate_bending.pdf

See also:  Dynamic Response to Enforced Motion

* * *

– Tom Irvine

The Static Deflection Method

The static deflection method can be used for estimating the fundamental frequency of a grounded dynamic system. A 1 G body load is applied to the system for this analysis.

The method can be used as a “ballpark” check for finite element models in conjunction with modal analysis.

Here is a tutorial paper.

The paper also demonstrates the use of the static deflection shape as the starting vector for the inverse power iteration method for obtaining a better estimate of the fundamental frequency.

Matlab script: inverse_power_iteration_manual.m

* * *

– Tom Irvine

Vibrationdata Finite Element Package

I have begun work on a Matlab GUI finite element package for structural dynamics.

This is a long-term work-in-progress!

Here is the current package:


vibrationdata_fea_preprocessor.m is the main script.  The remaining scripts are supporting functions.

* * *

Here are sample input files in Excel format:


* * *

Here is a preliminary user guide:


Reference papers:

Response of a Two-degree-of-freedom System Subject to a Half-Sine Applied Force

Sample Lateral Natural Frequency Calculations for a Space Vehicle/Dispenser Analysis

Assembly of subsystem matrices

* * *

The user is responsible for consistent units.

The package allows for nodes and elements in a 3D space.  There are three translational and three rotational degrees-of-freedom per node.

The available elements are dof springs, point masses and rigid links.  Additional elements will be included in future revisions, such as beams, plates, gap springs, etc.

This package began as a preprocessor.  The mass and stiffness matrices can be exported.

But the package will also solve for the normal modes.  Forced response and enforced acceleration will added in future revisions, both for frequency and time domain analyses.  Static analysis and buckling are also on the to-do list.

The scripts have some error-detection capability, but further checks are needed.

Please let me know if you have any comments, suggestions, or find any bugs.

* * *

See also:  Vibrationdata Finite Element

* * *

Thank you,
Tom Irvine
Email: tom@irvinemail.org

Convert Time History to Nastran format

Here is a Matlab script that converts a time history to a format which can be input to Femap or some other preprocesser for Nastran analysis. time_history_nastran.m

with supporting function: datafix.m

It can be used for force, pressure, acceleration or other amplitude types.

The script writes the Nastran data to an external ASCII text file, which would typically have a *.nas or other Nastran-friendly extension per the user’s choice.

– Tom Irvine

Beam Bending, Finite Element Analysis

Here is a paper which gives a derivation of the mass and stiffness matrices for beam bending: beam_FEM.pdf

* * *

Here is a Matlab script for the modal analysis of a straight beam. beam.zip

* * *

Here is Matlab script for the modal analysis of a rotating beam such as a helicopter blade: beam_rotating.zip

Here is a paper: Beam_FEM_rotating.pdf

* * *

Here is a Matlab script for the beam bending response to base excitation: beam_base_accel_fea.zip

* * *

See also:

Dynamic Response to Enforced Motion

Beam Bending Natural Frequencies & Mode Shapes

– Tom Irvine

Finite Element Transient Analysis

There is a need in certain structural dynamics finite element analysis problems to perform a response analysis in the time domain. This would be the case, for example, if the stiffness was non-linear. Loss-of-clearance or contact between two adjacent vibrating parts is another analysis example.

Consider the case of base excitation in the form of a PSD. A time history can be readily synthesized to satisfy the PSD. The corresponding number of time history samples may overwhelm the finite element program’s allowable array sizes or cause excessive processing time and memory usage, however.

Certain military and aerospace PSD specifications have an upper frequency of 2000 Hz. A synthesized time history should thus have a sample rate of at least 20 KHz, which is ten times the highest PSD frequency. The total number of time history points would be 1.2 million if the specified duration was 60 seconds.

Now consider that the peak response must be calculated and that fatigue is unimportant. This would be the case for evaluating the resulting response with respect to yielding, ultimate stress limit, or relative displacement.

A shorter duration time history can be synthesized to satisfy this need as presented in this paper: Abbreviated_FEA_Transient.pdf

The abbreviated time history is derived using response spectra. Its response spectrum must envelop that of the full-duration PSD as determined from Rayleigh distribution of the PSD response.

* * *

Matlab Scripts for this Method:



* * *

See also:

SDOF Response to an acceleration PSD Base Input

Peak Response for Random Vibration

* * *

– Tom Irvine


Here are some edited notes given to me by a colleague who is writing software programs to import Nastran data into Matlab.


DMAP (Direct Matrix Abstraction Programming) is the language running under the hood in the various nastran solution sequences.  All the math that happens in nastran is basically written in DMAP.  Some folks write DMAP alters to jump into the middle of a sequence of solution steps to extract info (like a stiffness matrix) or to change something in the process, or to do their own solution.  Generally only the local guru is writing alters and other folks would use them.  It’s almost like speaking Aramaic IMHO.  Old irritating language compared to Matlab.  Internally in Nastran, there is also something called NDDL (Nastran Data Definition Language)  This is even more obscure than DMAP, I think, but I used the NDDL to figure out how to parse the binary op2 files.

We were parsing nastran *.pch ascii files to read mode shapes, but we found that for large datasets the binary reader is MUCH faster.  Literally, hours vs. a couple seconds.  It’s also nice to have the data packaged into neat little Matlab structures.


An op4 file may contain matrices only and is generated using dmap alters in nastran.  These matrices maybe complex single, complex double, real single, real double or null.  The storage scheme may be dense, or two different flavors of sparse.  The files may also be ascii or binary.  I gave you an example of each of these in the zip file.  The file names hint at whether it is ascii or binary and the storage scheme (dense or sparse).   Op4 is a common format for exchanging craig bampton models.


An op2 file is generated using param,post,-1 in nastran.  I believe this is the most common binary output format in nastran, with xdb coming in second.  This format can store matrices if you write a dmap to do it, but more generally, it stores “datablocks” that have structured data of “whatever.”

– Tom Irvine