# MATLAB problem with Kapitsa pendulum(mostly about second order differentiation)

by lahuxixi
Tags: differentiation, kapitsa, matlab, order, pendulummostly
 P: 10 2. Relevant equations Theory for Kapitsa pendulum predicts that the motion consists of 2 parts: x(t)=X(t)+ x˜(t) (1) With fast oscillations: x˜(t)=−AX(t)sin(wt) /(w^2) (2) and a slowly varying motion X(t) which satisfies the following equation, X''=(1−(A^2)/(2w^2))X (3) 1. The problem statement, all variables and given/known data 1. Find the analytical solution of the equation (3) and derive the criterion of stability of the point X = 0 in terms of the parameters A and w.For the stable case, nd the period of oscillations of X(t) in terms of A and w, and the shape of the trajectory in the phase plane. For the unstable case, nd the growth rate of deviation from the equilibrium point and nd the trajectory in the (X; X') phase plane. 2. Rewrite the equation x''=x(1+Asin(wt)) as a system of two rst order ODE's so that the Matlab programme ode45 could be used. Create a function le for the right-hand-side of this system to be used by ode45 to solve it. 3.Consider the stable trajectories, with emphasis on the values of w close to the critical value wcrit. Find approximate periods for X(t). For this, you will need to run solutions for different time intervals and find for the interval which leads to the first approximate return of the trajectory to the initial phase-space point (not necessarily an exact return, because recurrence in X does not imply exact recurrence in x). Do these periods agree with the analytical formula you obtained above (in part 1)? What happens to the period when w tends to its critical value? 3. The attempt at a solution Ok,this is what i currently have: After solving the first question, i know that: x(t)=x(0)cos(sqrt(A^2/(2w^2)-1)*t) I know that if A^2/(2w^2)-1 is less than 0, then it is unstable, otherwise it is stable The period seems to be 2*pi/sqrt(A^2/(2w^2)-1) But i don't know how to find the shape of the trajectory in the phase plane, from what i know, i have to insert the formula into Matlab to obtain the graph . For the unstable case, find the growth rate of deviation(i don't know what the growth rate of deviation is and how to find it) from the equilibrium point and find the trajectory in the (X; X') phase plane.( please help me with this too) 2. Rewrite the equation x''=x(1+Asin(wt)) as a system of two rst order ODE's so that the Matlab programme ode45 could be used. For this, i can split it into two part: x'=y y'=x(1+Asin(wt)) But i don't know how to create a function file for the right-hand-side of this system to be used by ode45 to solve it.
 PF Gold P: 162 Hi lahuxixi. Welcome to the forums! You need to show an attempt at a solution before we can help you. Why don't you start by doing part 1 and the first half of 2. Those parts of the question have nothing to do with computers.
 P: 10 Ok,this is what i currently have: After solving the first question, i know that: x(t)=x(0)cos(sqrt(A^2/(2w^2)-1)*t) I know that if A^2/(2w^2)-1 is less than 0, then it is unstable, otherwise it is stable The period seems to be 2*pi/sqrt(A^2/(2w^2)-1) But i don't know how to find the shape of the trajectory in the phase plane, from what i know, i have to insert the formula into Matlab to obtain the graph . For the unstable case, find the growth rate of deviation(i don't know what the growth rate of deviation is and how to find it) from the equilibrium point and find the trajectory in the (X; X') phase plane.( please help me with this too) 2. Rewrite the equation x''=x(1+Asin(wt)) as a system of two rst order ODE's so that the Matlab programme ode45 could be used. For this, i can split it into two part: x'=y y'=x(1+Asin(wt)) But i don't know how to create a function file for the right-hand-side of this system to be used by ode45 to solve it.
PF Gold
P: 162

## MATLAB problem with Kapitsa pendulum(mostly about second order differentiation)

The best thing to do when you're learning matlab is to find an example online and change it. So here is an example I found for ode45. In matlab go to file -> new -> function and then copy and past the below code into the file that comes up and save it as F.m. Of course you'll need to change the actual function to suit your needs.

function xp=F(t,x)
xp=zeros(2,1); % since output must be a column vector
xp(1)=x(2);
xp(2)=-t*x(1)+exp(t)*x(2)+3*sin(2*t); % don’t forget ; after each line
PF Gold
P: 162
 Quote by lahuxixi But i don't know how to find the shape of the trajectory in the phase plane, from what i know, i have to insert the formula into Matlab to obtain the graph .
The command for plotting in matlab is 'plot'. Why don't you try finding a plotting example online and see if you can change it to suit your needs. If you run into trouble go ahead and post.

 Related Discussions Introductory Physics Homework 1 Math & Science Software 0 Calculus & Beyond Homework 1 Math & Science Software 4 Math & Science Software 0