Assume that water is pumped into an initially empty tank. The rate of flow of wa
ID: 3572668 • Letter: A
Question
Assume that water is pumped into an initially empty tank. The rate of flow of water into the tank at time t in seconds is (40-2t) liters per second. The amount of water Q that flows into the tank during the first x seconds can be shown to be equal to the integral of the rate of flow, evaluated from 0 to x seconds. Write down a script that computes and displays the answers for the following questions: (a) Determine the symbolic expression that represents the amount of water in the tank after x seconds. (b) Determine the amount of water in the tank after 10 seconds. (c) If the capacity of the tank is 400 liters, how long does it take to fill? Can you please write the script in matlab!! I also would like if you could write the script so I could just rewrite it in my own matlab. Comments would be awesome as well! thank you
Explanation / Answer
%a part
syms t
int(40-2*t, 0, x) %int function integrate the expession
%first argument is expression
%second and third argument is lower bound and upper
%bound respectively
%b part
syms t
int(40-2*t, 0, 10) %integrate expression from 0 to 10 and answer is 300.
%c part
%int(40-2*t, 0, x) %-x*(x - 40) equation after integration
p = [1 -40 400]; %create vector of polynomial equation x^2-40*x+400
%we have to find root of this equation
r = roots(p) %which give ans=20