% Nathan Lorah In Class Work 2-28-13
% What is the mass
m1 = input('What is the mass (in kilo grams) of the block on the ramp.>');
m2 = input('What is the mass (in kilo grams) of the block hanging from the pully.>');
% Making the mass 8 digets
sm1 = single(m1);
sm2 = single(m2);
% What is the angle
ang = input('What is the angle of the ramp at which the block is on. (Between 0 and 90)>');
% Finding Static and Kenetic Friction
matq = menu('What are the block and ramp made of?','Wood and Wood','Steel and Steel, Lubricated','Steel and Steel, Dry','Rubber and Concrete','Wood and Snow','Ice and Ice');
if matq == 1
usf = 0.50;
ukf = 0.20;
elseif matq == 2
usf = 0.10;
ukf = 0.05;
elseif matq == 3
usf = 0.80;
ukf = 0.60;
elseif matq == 4
usf = 1.00;
ukf = 0.80;
elseif matq == 5
usf = 0.12;
ukf = 0.06;
else
usf = 0.10;
ukf = 0.03;
end
% Equations for Friction
fn = (sm1)*(cosd(ang));
fsf = (usf)*(fn);
fkf = (ukf)*(fn);
% Gravity - on Earth or not
q = menu('Where are you?','Sun','Mercury','Venus','Moon','Mars','Jupiter','Saturn','Uranus','Neptune','Pluto','Empty Space','Earth');
if (q) == 1
fprintf('ouch, that''s hot\n')
g = 274.13;
elseif (q) == 2
g = 3.59;
elseif (q) == 3
g = 8.87;
elseif (q) == 4
g = 1.62;
elseif (q) == 5
g = 3.77;
elseif (q) == 6
g = 25.95;
elseif (q) == 7
g = 11.08;
elseif (q) == 8
g = 10.67;
elseif (q) == 9
g = 14.07;
elseif (q) == 10
g = 0.42;
elseif (q) == 11
g = 0;
else
g = 9.81;
end
% What do the blocks do
% With Static Friction
soffonxm1wof = (sm2)*(g) - (sm1*g*sind(ang));
if (soffonxm1wof) > 0;
soffonxm1s = (sm2)*(g) - (sm1*g*sind(ang)) - (fsf);
elseif (soffonxm1wof) < 0;
soffonxm1s = (sm2)*(g) - (sm1*g*sind(ang)) + (fsf);
else
fprintf('Neither of the blocks will move\n')
end
% With Kenetic Friction
if (soffonxm1s) > 0;
soffonxm1 = (sm2)*(g) - (sm1*g*sind(ang)) - (fkf);
elseif (soffonxm1s) < 0
soffonxm1 = (sm2)*(g) - (sm1*g*sind(ang)) + (fkf);
else
fprintf('Neither of the blocks move\n')
end
% Acceleration on Block 1
acceleration_on_block_on_ramp = (soffonxm1)/(sm1)