Matlab ODE Problem (paritcle trajectory)

2 replies · 2K views · last reply
intrepid44
Messages
3
Reaction score
0
Hi, I currently have this problem to solve, and I'm quite stuck. I would much appreciate it if anyone could point me in the direction on how to solve it.

Worksheet page on a cycloid: text defining r(z) = πQ − Q cos⁻¹(z/Q − 1) + √(z(2Q − z)), a 3D rendering of a cycloidal basin, and a plot of height, vertical velocity and distance from axis against time for a mass sliding in the basin.


This is my go at it, although currently I don't have access to MATLAB until tomorrow as the university library has now closed.

Handwritten-style typeset derivation: z'' = -(g/Q)(z - h/2), then g = 9.81, Q = 5, h = 3, z(0) = 0, z'' + 1.962z + 2.943 = 0, dz/dt = z2, dz2/dt = -1.962z1 - 2.943, and d/dt(z1, z2) = (z2, -1.962z1 - 2.943), followed by MATLAB lines defining f and calling ode23 over [0, 20] with initial condition [0; 0], then plot(T, Z).


Is this the correct way to get the motion? If I then turn it into a function?

Many thanks.

Regards,
intrepid44
 
The last bit should be: >> f = @(t,z) [z(2);-1.962*z(1)-2.943];