Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Name : KV Rohan Varma

USN : 23BTRDC058

Branch : Data science

MATLAB ASSIGNMENT 5

1) A body originally at 140 cools down to 80 in 20 minutes. If the temperature of the air is 30 . Find
the temperature of the body after 35 minutes.

T_initial = 140;
T_final = 80;
T_ambient = 30; time_elapsed = 20; k = -1 / time_elapsed * log((T_final -

T_ambient) / (T_initial - T_ambient)); time_after = 35; T_at_time_after =

T_ambient + (T_initial - T_ambient) * exp(-k * time_after);

fprintf('Temperature of the body after %d minutes: %.2f\n', time_after,


T_at_time_after);

Temperature of the body after 35 minutes: 57.68

2) The number of species in a culture is growing at a rate of 2000 per unit of time t . At t = 0, the number of
bacteria present was 5,200. Find the number present at t = 7.
clear
all clc
syms
x(t)
ode = diff(x,t)==2000*exp(2*t/5);
cond=x(0)==5200;
xsol(t)=dsolve(ode,cond);
n = 7;
population_Size=subs(xsol(t),t,n)

population_Size =

t = 0: n;
X = xsol(t); plot(t,X,'--
b') xlabel('Time');
ylabel('Time');
ylabel('Bacteria Population Size');
grid on

1
3) Solve the following LPP:

Minimize Z = 3

Subject to 8

12

where,
f = [-3; -4];
A = [1 2
3 2];
b=[8;,12;]; lb =
zeros(2, 1);
options = optimset('Display', 'iter');
[x, favl] = linprog(f, A, b, [], [], lb, [], options);

LP preprocessing removed 0 inequalities, 0 equalities,


0 variables, and added 0 non-zero elements.

Iter Time Fval Primal Infeas Dual Infeas


0 0.007 0.000000e+00 0.000000e+00 2.136001e+00
2 0.016 -1.800000e+01 0.000000e+00 0.000000e+00
Optimal solution found.

You might also like