MATLAB: Definite Integrals With Answer

definite integralshomeworkintegrals

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?
this is my homework problem. I've gotten through parts A and B but im confused when it comes to C. How do i set it so that the integral has an answer already? Do I use solve? I'm a little stuck and could use a pointer or hint. Thanks, this is what i have so far
clear
clc
close all
%Problem 1
syms t
FlowRate=40-2*t;
WaterAmount=int(40-2*t,0,t);
%Part A
disp('Part A')
disp('The amount of water in the tank after x seconds is')
disp('int(40-2*t,0,t')
%part B
disp('Part B')
TenSeconds=int(40-2*t,0,10);
disp('The amount of water after 10 seconds is')
disp(TenSeconds)
%Part C
disp('Part C')
400=int(40-2t,0,x)

Best Answer

For Part A, the instructor may want the answer in terms of x, not t. E.g.
syms x
disp(int(40-2*t,0,x)) % <-- Or disp(subs(WaterAmount,x))
For Part C, yes you can use the solve() function. Simply create a symbolic expression that should equal 0 and solve for the variable. In your case you want the water amount to be 400, so subtract 400 from this and solve for the variable. E.g.,
solve(WaterAmount-400)
Related Question