% This function defines the system dynamics for "sfbdir_ex1" function [y] = extdisc_ex3sys(t, x, flag, SysData, fcnflag) n = SysData.n; % Strip out the plant states xi = x(1:n); xi = xi(:); dxi = zeros(n, 1); % pre-allocate switch (fcnflag) case 'deriv' % Define the plant dynamics dxi(1) = xi(2); dxi(2) = 2*xi(1) - 0.1*(xi(1))^3; y = [dxi]; case 'output' y = [xi(1); xi(2)]; end