Homework 11 Solutions PS321 1. (from Marion and Thornton)

advertisement
Homework 11 Solutions
1. (from Marion and Thornton)
PS321
2. (from Marion and Thornton)
3.
a. (from Marion and Thornton)
b. Several trajectories are shown below. The Matlab code used follows.
Main Script:
[t q]=ode45('springpendulum',[0 20],[0.31 0 .125*pi 0],odeset('RelTol',1e-5));
x=q(:,1).*sin(q(:,3)+pi);
y=q(:,1).*cos(q(:,3)+pi);
figure(1);
plot(x,y);
axis square
xlabel('x-position of bob (m)','fontsize',14);
ylabel('y-position of bob (m)','fontsize',14);
title('Springy Pendulum','fontsize',14);
set(gca,'fontsize',12);
Function Representing the Equations of Motion
function y=springpendulum(t,x)
L=x(1);
Ldot=x(2);
theta=x(3);
thetadot=x(4);
b = 0.30;
m = 0.05;
k = 20;
g=9.81;
y=[
Ldot;...
L*thetadot^2-k/m*(L-b)+g*cos(theta);...
thetadot;...
-2/L*Ldot*thetadot-g/L*sin(theta)];
4. (from Marion and Thornton)
5. (modified version of Marion and Thornton problem 7-18).
Time trace and phase space trajectories are shown below followed by the Matlab code used to
generate them.
Main Script
L=4; R=1;
theta0=L/R*0.99999; % Numerical olution breaks down if it goes all
% the way to the end of the string.
[t q]=ode45('yoyothing',[0 20],[theta0 0],odeset('RelTol',1e-8));
figure(1);
plot(t,q(:,1));
axis([0 20 0 5 ]);
xlabel('time (s)','fontsize',14);
ylabel('\theta (radians)','fontsize',14);
title('Yo-yo like thing','fontsize',14);
set(gca,'fontsize',12);
figure(2);
plot(q(:,1),q(:,2));
axis([-5 5 -5 5]);
xlabel('\theta (radians)','fontsize',14);
ylabel('d\theta/dt (radians/s)','fontsize',14);
title('Yo-yo like thing','fontsize',14);
set(gca,'fontsize',12);
Function Representing the Equation of Motion
function y=yoyothing(~,x)
theta=x(1);
thetadot=x(2);
L = 4;
R = 1;
g=9.81;
y=[
thetadot;...
( R*thetadot^2 + g*cos(theta) )/(L-R*theta)];
Download