Simulation Velocity of a harmonic oscillator system

167 Views Asked by At

I am write a simulation for get true Velocity of a harmonic oscillator system as

enter image description here

Where P=[p1 p2;p2 p3] can find using Rung-Kutta Integration method with P(0)=[1 0; 0 1] This is code to find p

Now, I want to write matlab code to get the true postion z of the system and estimate x inwhich x=[x1 x2]'. This is my code to find x and z. However, the result is not correct. This is my result enter image description here

Let see help me is correct implement for the solution. Thank you