function dx = cnnderiv(t,x)
%CNNDERIV derivative of 2D CNN
% takes and returns current state as
% a column vector.
%       requires global variables A Bu I m n 

% Courtesy of Kenneth R. Crounse, crounse@fred.EECS.Berkeley.EDU.
 
global Atem Bu I m n 

x = reshape(x,m,n);

dx = -x + reflect_corr2(pwlsig(x),Atem) + Bu + I ;
%dx = -x + circ_corr2(pwlsig(x),Atem) + Bu + I ;

dx = dx(:);









