function dydt = odefun11(t,w)
x = w(1);
y = w(2);

qin=1.5;c=1;

p = [1 y 1 -1.2];       % z^3 + y*z^2+z-1.2 % alg eq
R = roots(p)

if isreal(R)==0   % checks the number of real roots of polynomial p
    z1 = R(3);     % last root is always real
    z2 = R(1);     % first root is complex
    s = 1;  
    f1 = qin-c*x-s*z1+(1-s)*z2;       % differential eq
    f2 = 1/y;               % differential eq 
    
else % all roots are real
    z1 = max(R);  % chose maximum root
    z2 = min(R);  % chose minimum root
    s=0;
    f1 = qin-c*x-s*z1+s*z2;       % differential eq
    f2 = 1/y;               % differential eq 
    
end

dydt = [f1;f2];
end



