You are on page 1of 4

Sol

M File

disp('This software calculates the shear force');

d=input('Enter the diameter of the bolt in millimeters=');

st=input('Enter the shear stress in mega pascal=');

a=(pi/4)*(d^2);

f=st*a;

fprintf('The shear force in newtons is %3.1f\n ',f);

Output

This software calculates the shear force

Enter the diameter of the bolt in millimeters=5

Enter the shear stress in mega pascal=120

The shear force in newtons is 2356.2


Sol

M file

disp('This software calculates the diameter of the pin');

f=input('Enter the force in newtons=');

st=input('Enter the shearstress in megapascal=');

a=(f/st);

d=sqrt((4*a)/pi);

fprintf('The diameter in millimeters is %3.1f\n',d);

Output

This software calculates the diameter of the pin

Enter the force in newtons=400

Enter the shearstress in megapascal=120

The diameter in millimeters is 2.1

Sol

M File

disp('This software calculates the stress in the tube');


od=input('Enter the outside diamter in millimeters=');

id=input('Enter the inside diameter in millimeters=');

l=input('Enter the load in newtons=');

a=(pi/4)*((od^2)-(id)^2);

st=l/a;

fprintf('The stress in megapascal is %3.1f\n',st);

Output

This software calculates the stress in the tube

Enter the outside diamter in millimeters=60

Enter the inside diameter in millimeters=40

Enter the load in newtons=60000

The stress in megapascal is 38.2

You might also like