write a matlab code to solve for depth y from t0 to 10 days
write a matlab code to solve for depth y from t=0 to 10 days with a step size of .1 days. plot a graph of days vs depth and make a table.
equation
dy/dt= 3*(Q/A)*sin^2 (t)-(Q/A)
Q=450
A=1250
initially y=0
Solution
Q = 500; % flow constant m^3/d
A = 1200; % area, m^2
y = 0; % initial depth
a = 300;
time = [];
res = [];
d_t = .005; % step size
for t = 0:d_t:10,
time = [time, t];
res = [res, y];
y = y + d_t*(3*Q/A*sin(t)^2-(a*(1+y)^1.5)/A);
end
hold off;
plot(time, res, \'k\');
hold on;
plot(time, (Q*(time-3*sin(time).*cos(time)))/(2*A))
xlabel(\'Time (days)\')
ylabel(\'Depth (m)\')
title(\'Depth over Time of a Storage Tank\')
