SQRT Atan: Function Global G - CM K - CM M y - Pivot - Location String - Length C

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

function [ dydz ] = spring_pendulum(t,z)

global g_cm k_cm m y_pivot_location string_length c


L = sqrt(z(1)^2 + (y_pivot_location - z(3))^2);
theta = atan(0 - z(1) / (y_pivot_location - z(3)));
dydz = [z(2);...
(k_cm/m) * (L - string_length) * sin(theta) - (c/m)*z(2);...
z(4);...
(k_cm/m) * (L - string_length) * cos(theta) + g_cm - (c/m)*z(4);];
end

You might also like