MATLAB: Foucault Pendulum

ode

I am inexperienced with matlab and have not used the ODE command before. I am trying write a code for the Foucault pendulum. I know there are example on the interent but they are not too helpful.
Here are my two differential equations and initial conditions
ddot(x) + (Omega^2)*x - 2*P*dot(y) = 0
ddot(y) - (Omega^2)*x - 2*P*dot(y) = 0
g = 9.81; % acceleration of gravity (m/sec^2)
l = 60; % pendulum length (m)
b = .2;
initial_x = .2; % initial x coordinate (m)
initial_y = b/2; % initial y coordinate (m)
initial_xdot = 0; % initial x velocity (m/sec)
initial_ydot = 0; % initial y velocity (m/sec)
Omega=2*pi/86400; % Earth's angular velocity of rotation about its axis (rad/sec)
lambda=0/180*pi; % (0, 30, 60, 90)latitude in (rad)
P=Omega*sin(lambda)
C=(g/l)^2;

Best Answer

First of all you have to reduce the order of an ODEs:
Next write fuction that describes the problem:
function dy = focaultPendulum(t,y)
% define your constants
dy = zeros(4,1);
dy(1) = y(2);
dy(2) = ... % your equation
dy(3) = y(4);
dy(4) = ... % your equation
And solve and plot:
[T,Y] = ode45(@focaultPendulum,tspan,initial_values);
plot(T,Y(:,1),T,Y(:,3))
Related Question