function dx = nonlinear_fluid_state(t,x,u_fun,R_fun)
global C L
% x(1) is P_C
% x(2) is Q_L
% R_fun is the nonlinear resistance

% call input function at this time step
Q_s = u_fun(t);

% compute nonlinear resistance at this time step
R = R_fun(x(1));

dx = zeros(2,1);    % a column vector
dx(1) = (Q_s - x(2))/C;    % d P_C/dt
dx(2) = (x(1) - x(2)*R)/L; % d Q_L/dt