4. Matlab Code

%distances in inches

%input with constant rotational velocity

th = 0:1:360;

rpm = 30; %one second to turn turner one rotation

win = rpm*60/(2*pi); %rad per sec 

ain = 0;

%cams (assuming consistent change in radius)

rs = 0.6; %smallest radius

rl = 1.45; %largest radius

rate = (rl-rs)/360;

r = rs:rate:rl;

%penguin head

ax7 = 5.1; %length of axle 7

h = r + ax7; %height from spinning axle

plot(th,h)

title('Position of Penguin Body/Head Over the Turning Radius');

xlabel('turning theta');

ylabel('position of penguin');

(position along the vertical y axis from the turning mechanism axle)

plot(th,v)

title('Velocity of Penguin Body/Head Over the Turning Radius');

xlabel('turning theta');

ylabel('velocity of penguin (in/s');

%constant velocity, therefore no acceleration


%wing tips

wing = 3.1; %length from fulcrum to tip

f = 0.8; %length from fulcrum to 'armpit' hitting wings causing motion

armpit = h - .75; %height of armpit

vap = v;

wwing = vap./f; %rotational velocity of wing

thwmin = -50;

plot(th,wwing)

title('Rotational Velocity of the Wings Over the Turning Radius');

xlabel('turning theta');

ylabel('rotational velocity of the wings (in/s)');

%constant rotational velocity, therefore no rotational acceleration

thw(1) = thwmin;

for i = 2:361

    thw(i) = wwing(i)*180/pi*tdelt + thw(i-1); %in/s

end

plot(th,thw)

title('Theta of the Wings Over the Turning Radius');

xlabel('turning theta');

ylabel('theta of the wings (deg)');


%path of wings (tip of the wings)

ax11 = 3.3; %top of igloo to wing fulcrum

wingx = wing.*cosd(thw);

lwingx = -wingx; %left wing

wingy = wing.*sind(thw)+ax11;

plot(wingx,wingy,lwingx, wingy)

axis([-3.2 3.2  0 6.4])

title('Path of the Wings from Igloo Base');

xlabel('x (in.)');

ylabel('y (in.)');