Question: Please answer using matlab only % Simple Pendulum solved by Euler's method with out small angle approximation clear; help pendE theta = 10*pi/180; theta_dot =
Please answer using matlab only
% Simple Pendulum solved by Euler's method with out small angle approximation clear; help pendE theta = 10*pi/180; theta_dot = 0; tau = 0.1; g_l = 1; nstep = 300; time = 0;
for istep =1:nstep t_plot(istep) = time; th_plot(istep) = theta; acc = - g_l*sin(theta); theta_dot = theta_dot + acc*tau; theta = theta + theta_dot*tau; %Cromer step time = time + tau; end
plot(t_plot, th_plot) xlabel('Time') ylabel('Theta') grid
11. Modify the pendul program so that it plots (,) versus (t), that is, a phase space plot. Instead of running for a fixed number of steps, have your program halt the calculation when the pendulum completes one period. Plot the data for initial angles of 0, 45, 90, 120, and 170. Notice the difference in the shapes of the phase space orbits as a function of the initial angle. Be sure to use the Verlet method 11. Modify the pendul program so that it plots (,) versus (t), that is, a phase space plot. Instead of running for a fixed number of steps, have your program halt the calculation when the pendulum completes one period. Plot the data for initial angles of 0, 45, 90, 120, and 170. Notice the difference in the shapes of the phase space orbits as a function of the initial angle. Be sure to use the Verlet method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
