```
function BSA = BodySurA(w,h)
% calculate BSA in m^2
% where h is in cm and W is in KG
h = h .* 0.3937 ; % converts cm to inches
w = w .* 2.2046 ; % converts KG to lb
BSA = sqrt( h .*w/3131 )
end
% reads data from given spreadsheet
data = xlsread('PersonalInfo (1).xls');
ID = data(:,1);
Gender = data(:,2);
Height = data(:,3);
Weight = data(:,4);
BSA = BodySurA(Weight,Height);
% calculate the average BSA for Male group
idxMale = find(Gender==0);
BSAMale = BSA(idxMale);
AverageBSAMale = sum(BSAMale)/length(BSAMale)
fprintf('The average BSA for male group is %1.4f', AverageBSAMale)
% calculate the average BSA for Female group
idxFemale = find(Gender==1);
BSAFemale = BSA(idxFemale);
AverageBSAFemale = sum(BSAFemale)/length(BSAFemale)
fprintf('The average BSA for female group is %1.4f', AverageBSAFemale)
```

```
clc, clear all, close all
%% Question 1
syms x y z
%% Question 2
fprintf("\n\nQuestion 2:\n");
% let's solve using symbolic solver
xsol = double(solve(x^4 + 2*x^3 - 8*x^2 - 9*x+18==0))
%% Question 3
fprintf("\n\nQuestion 3:\n");
xsol = double(solve(x^3 - 5*x^2 == -x-15))
%% Question 4
fprintf("\n\nQuestion 4:\n");
% The intersection points are the solutions of the equation
sol = solve([4*x^2+5*(y-1.5)^2 == 40;y-3*x+1==0], [x,y]);
xsol = double(sol.x)
ysol = double(sol.y)
%% Question 5
fprintf("\n\nQuestion 5:\n");
% Define the system of equations
equations = [2.1*x+6.2*y-3.1*z==205;
-3.7*x+10.8*y+1.1*z == -107;
x+2*y-3*z==23];
sol = solve(equations, [x,y,z]);
xsol = double(sol.x)
ysol = double(sol.y)
zsol = double(sol.z)
%% Question 6
fprintf("\n\nQuestion 6:\n");
% We will use x = F1 and y = F2
equations = [(1 + cosd(30))*x + 10.3*cosd(25)*y == 0;
5*sind(30)*x - 5.6*sind(25)*y == 30];
sol = solve(equations, [x,y]);
F1 = double(sol.x)
F2 = double(sol.y)
%% Question 7
fprintf("\n\nQuestion 7:\n");
y(x) = tan(4-3*x)-sqrt(3);
% Now solve
xsol = double(solve(y(x)+2*x==7, x))
%% Question 8
fprintf("\n\nQuestion 8:\n");
clear y
syms y
z1(x,y) = 4*x^2+5*(y-1.5)^2 -40;
z2(x,y) = y-3*x+1;
% The intersection points are where z1== z2
sol = solve(z1==z2, [x,y]);
xsol = double(sol.x)
ysol = double(sol.y)
%% Question 9
fprintf("\n\nQuestion 9:\n");
% We will use x and y as our variables
% Define first equation
eq1 = x+y == 11; % the sum of both numbers is 11
eq2 = 10*y+x + 27 == 10*x+y;
sol = solve([eq1;eq2], [x,y]);
number = double(10*sol.x + sol.y)
%% Question 10
fprintf("\n\nQuestion 10:\n");
d = 250; %from A to B
va = 60;
vb = 0;
ab = -20;
aa = 0;
% Equation for position of a:
eq1 = va*x + aa*x^2 /2;
eq2 = d + vb*x + ab*x^2 /2;
sol = solve(eq1 == eq2)
t = double(sol);
t = t(t > 0); % take only the positive value
Xa = double(va*t + aa*t^2 /2)
Xb = double(vb*t + ab*t^2 /2)
fprintf("The trains met when they are at at distance of %.3f of station A\n", Xa)
```