Task 1
The concentration over time of a chemical in a reactor is given by the differential equation:
\[
\frac{d C}{d t}=2 t-\frac{1}{2} t^{2}
\]
In the partially completed script chemReactor.mlx, this ODE has been implemented in the local function reactor.
In this interaction, you will complete the script to determine the chemical concentration from \( t=0 \) to \( t=4 \), with an initial concentration \( C(0)=0 \).
TASK
Determine the chemical concentration over time and plot the result by completing the following steps:
1. Create a variable tRange to define the time interval over which to solve from \( t=0 \) to \( t=4 \).
2. Create a variable \( C 0 \) to define the initial concentration, \( C(0)=0 \).
3. Use ode45 to solve the differential equation, which has been implemented for you in the local function reactor. Assign the result to the output variables tSol and CSol.
4. Plot the concentration \( \mathrm{CSol} \) as a function of \( \mathrm{tSol} \).