% Jacobian of "myfun".
function J = dmyfun(x,m,n)

    J = zeros(m,n);
    J(1,1)=2.0*x(1); J(1,2) = 2.0*x(2);
    J(2,1)=1; J(2,2) = -4;
    %J(3,1)=8.0*x(1); J(3,2) = 10.0*x(2);
    J(1,1)=2*x(1)-x(2)*cos(x(1)+x(2));
    J(1,2)=-x(2)*cos(x(1)+x(2))-sin(x(1)+x(2));
    J(2,1)=x(2);
    J(2,2)=x(1);