% ccquad.m function d=cclin(t,x) % CCQUAD(T,X) provides the RHS for a homogeneous, constant coefficient % quadratic system ODE45. The matrix A is the linear part of the system. % It is entered directly into the initsys.m file. Bx1 and Bx2 contain % the quadratic and cross-term coefficients of the system, respectively. % They are created from the B matrix entered into the initsys.m file. global A B Bx1=[x(1),0; 0,x(1)]*[B(1,2),B(1,1); B(2,2),B(2,1)]; Bx2=[x(2),0; 0,x(2)]*[0,B(1,3); 0,B(2,3)]; d=(A + Bx1 + Bx2)*x(:);