function Xi = sparsifyDynamics(Theta,dXdt,lambda,n) % Copyright 2015, All Rights Reserved % Code by Steven L. Brunton % For Paper, "Discovering Governing Equations from Data: % Sparse Identification of Nonlinear Dynamical Systems" % by S. L. Brunton, J. L. Proctor, and J. N. Kutz % compute Sparse regression: sequential least squares Xi = Theta\dXdt; % initial guess: Least-squares % lambda is our sparsification knob. for k=1:10 smallinds = (abs(Xi)