top of page

Phase 1 Workbook: Nonlinear Truss Element using Newton-Raphson (with MATLAB)

This workbook builds a nonlinear axial truss model using the Newton-Raphson method and a bilinear elastic-plastic material model. It includes a numerical example for a 2-bar truss system with stiffness matrix assembly and step-by-step MATLAB code snippets.




1. Problem Setup: 2-Bar Truss

We analyze a 2-bar truss:- Node 1: fixed- Node 2: common free node- Node 3: loaded right-end node- Bar 1: Node 1 to Node 2- Bar 2: Node 2 to Node 3- External load applied at Node 3


2. Properties

Given:- A = 0.01 m²- E = 200 GPa- σ_y = 250 MPa- E_t = 2 GPa- L = 2 m (each bar)- Load: from 0 to 300 kN in 30 kN increments


3. MATLAB Initialization

% Geometry and Material

A = 0.01;

E = 200e9;

Et = 2e9;

sigma_y = 250e6;

L = 2;

F_ext = (0:30e3:300e3)';

n_steps = length(F_ext);

% Nodes and Connectivity

coords = [0; 2; 4];

conn = [1 2; 2 3];

% connectivity: 2

barsndof = length(coords);

u = zeros(ndof,1);

u_hist = zeros(n_steps, 1);


4. Newton-Raphson Solver Loop

for step = 1:n_steps   

f_ext = zeros(ndof,1);    

f_ext(end) = F_ext(step);    u_iter = u;   

for iter = 1:20         f_int = zeros(ndof,1);         K_global = zeros(ndof);        for e = 1:size(conn,1)            i = conn(e,1);

j = conn(e,2);           

Le = coords(j) - coords(i);            ue = u_iter([i j]);            eps = (ue(2) - ue(1)) / Le;             if abs(eps E) < sigma_y                 Ee = E;            else                Ee = Et;            end           

ke = AEe/Le [1 -1; -1 1];            fe = ke*ue;           

idx = [i j];           

K_global(idx,idx) = K_global(idx,idx) + ke;       

     f_int(idx) = f_int(idx) + fe;       

end      

  r = f_ext - f_int;       

if norm(r) < 1e-3, break;

end       

du = K_global \ r;       

u_iter = u_iter + du;   

end   

u = u_iter;   

u_hist(step) = u(end);

end


5. Results and Interpretation

- The force-displacement plot will show linear behavior up to yield load, then flatten due to plastic deformation.- The code demonstrates global matrix assembly using local element stiffness updates.- The Newton-Raphson method tracks nonlinear behavior accurately and efficiently.

Recent Posts

See All
bottom of page