# Chapter4

Problem 1
Script file:

%problem 1
w = input(‘Enter your weight ‘);
h = input(‘Enter your height ‘);
BMI = 703 * (w/(h^2))
Problem 2
Script file:

%problem 2
p = input (‘Enter the pressure in units of millibars ‘);
h = 145366.45 * (1-(p/1013.25)^(0.190289));
fprintf(‘The altitude is %.0f ft’, h)
Problem 3
Script file:

%problem 3
R = input(‘Enter the cone base radius ‘);
h = input(‘Enter the cone height ‘);
r = ((h * R)/(sqrt(R^2 + h^2)))/(1+((R)/(sqrt(R^2 + h^2))))
fprintf(‘The radius of the largest sphere that can be inscribed inside a cone with a base radius of %.1f in. and height of %.1f in., is: %.1f in.’, R, h ,r)
Problem 4
Script file:

%problem 4
halfL = input(‘Enter the half life of material in years: ‘);
material =input(‘Enter the current amount of materials in lbs: ‘);
years = input(‘Enter the number of years from now for which the amount should be calculated: ‘);
halflives = years/halfL;
amountleft = (0.5)^halflives;
total = material * amountleft;
fprintf(‘The amount of the material after %f years is %f kg’, years, total)
Problem 5
Script file:

%problem 5
h = [0:2:14];
R = 14;
L = 36;
volume = L * (R^2 .* acos((R-h)/R) – (R-h) .* (sqrt((2*R.*h)- h.^2)));
vector = [h; volume]’
Problem 6
Script file:

%problem 6
theta = [0:10:90]
alpha = asin((1-3.*cos(theta))./sqrt((1+3.*cos(theta)).^2+(3-3.*sin(theta)).^2));
F= (300.*4.5.*sin(theta))./(3.*cos(alpha-theta));
F=F’;
disp(F)
Problem 7
Script file:

% Problem 7

disp(‘Problem 7’)

M=round(M*10)/10;

Std=round(Std*10)/10;

fprintf(‘The standard deviation is %5.1f.\n’,Std);

Problem 8
Script file:

% Problem 8

disp(‘Problem 8’)

A0=400;

k=log(1/2)/3.5;

t=[23,19,15,11,7,3];

A=A0.*exp((log(1./2)./(3.5)).*t);

At=sum(A);

fprintf(‘Total Amount Taken: %5.2f mg\n’,At);

Problem 9
Script file:

% Problem 9

disp(‘Problem 9’)

P=input(‘Enter the value of the initial investment:\n’);

t=input(‘Enter the number of years:\n’);

r=input(‘Enter the Yearly Interest Rate:\n’);

n=input(‘Enter the # of times per year the interest is compounded:\n’);

V=P*(1+((r/100)/n))^(n*t)

fprintf(‘The value of a \$%5.2f investment at a yearly interest rate of %5.2f%% compounded %1.0f times per year, after %2.0f years is \$%5.2f\n’,P,r,n,t,V);

Problem 10
Script file:

% Problem 10

disp(‘Problem 10’)

x=linspace(50,200,1501);

y=(2.*(sqrt((80.^2)+((210-x).^2))))+(210-x);

YMinimum=min(y);

xpos=find(y,1,’last’)

Problem 11
Script file:

% Question 11

disp(‘Question 11’)

h=[-500:500:10000];

p=29.921.*(1-((6.8753*10^-6).*h));

t=(46.101.*log(p))+44.932;

t=table(h’, t’, ‘VariableNames’,{‘Altitude’ ‘BoilingPoint’});

disp(t)