Solving differential equation that includes an (extra) unknown function

197 Views Asked by At

I am trying to find a solution for $C_a(t)$ in the below differential equation:

$$ V \cdot \frac {dC_a(t)} {dt}=R(t)-Q_v \cdot C_a(t) \\ $$ $ \text{Where} \\ \qquad V \text{ is the volume of the test chamber } [m^3] \\ \qquad C_a \text{ is the concentration in test chamber } \Big[\frac{kg}{m^3} \Big] \\ \qquad R \text{ is the non-constant emission rate from test sample } \Big[\frac{kg}{m^2 \cdot s} \Big] \\ \qquad Q_v \text{ is the constant volume flow rate of ventilation air passing through the test chamber } \Big[\frac{m^3}{s} \Big] \\ $ The non-constant emission rate is the "unknown function" mentioned in the question title. Stating that the function that governs emission rate is unknown is somewhat inaccurate as I have a vector containing values for emission for every examined time t.

Besides knowing values for $R$ at given times $t$, we know that $Ca(0) = 0$ and that $R(0) = 0$.

I am in the process of writing a small Matlab script, and therefore I am hoping to find a solution on a form that allows implementation and evaluation at given points in time (corresponding to the values in known vector $R$).

I have already given it my best, and I have arrived at the below expression (that I sincerely hope is correct). However, this expression considers $R(x)$ as a continuous function and will not be implemented easily. $$ C_a(t) = exp(-Q_v t V^{-1}) \int_{0}^{t} exp(-Q_v x V^{-1}) R(x) V^{^-1} dx, \quad for \ \ C_a(0)=0 $$ Can anybody help me find a simpler (explicit and fully analytical) solution for $C_a(t,R(t))$ that is easy to implement?

2

There are 2 best solutions below

0
On BEST ANSWER

Turns out that Matlab does have a function that allows for solving ODEs with time dependent terms.

Thank you all very much for your time and help.

1
On

The solution with initial value $C_a(0) = C_0$ is $$C_a(t) = \exp(-Q_v t/V) \left( C_0 + \int_0^t \exp(Q_v s/V) \frac{R(s)}{V}\; ds \right) $$ You can approximate the integral with Riemann sums.