I made my code like this,
function DK = pendulum_cartesian(t,K)
g = 9.8; l = sqrt(K(1)^2 + K(2)^2);
DK = zeros(4,1);
DK(1) = K(3);
DK(2) = K(4);
DK(3) = ( (-K(1)*K(3)^2) - (K(1)*K(4)^2) + K(1)*K(2)*g )/(l^2);
DK(4) = ( (-K(2)*K(3)^2) - (K(2)*K(4)^2) - (K(1)^2)*g )/(l^2);
theta = atan(K(2)/K(1));
plot(t,theta);
end
and i typed,
[t,K] = ode45(@pendulum_cartesian, [0,10], [0.1,0.00017,0.1,0])
but there is no value in theta, and plots nothing.
where is a problem?

