Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part 2 ) It is asked to solve for the dynamics of the model in part 1 with respect to time, using both analytical and
Part It is asked to solve for the dynamics of the model in part with respect to time, using both analytical and numerical approaches, and a comparison between the two approaches be offered. Numerical Solution: A modular and flexible programming approach is adopted in this assignment, and students will be encouraged to continue using this approach throughout the course. When designing a numerical implementation of the proposed solution, first an architecture should be decided upon. We would like this architecture to be modular, ie consisting of separate modules that performs unrelated tasks. This will prove to be useful for later assignments, when the student needs a module that just does the task. & main program handle variable assignment discretize the solution interval set up time loop for loop plot results in a graph main.m main call function ckeuler deriv call euler.m function deriv your derivative function deriv.m Figure Schematic diagram of the model Take the architecture proposed in Figure for example, the main program mainm that takes care of inputoutput assignment of variables, discretization of solution interval, and setting up an incremental solution scheme a loop over time that starts from to where denotes the final solution time The presentation of results in graphical andor tabular formats is also done here. Within the loop over time inside this main program, certain tasks need to be performed each step, such as calculation of the state derivative, or the integration performed according to Euler's formula, where refers to the step size between two increments in time. Now let's investigate how these this task will be performed. First consider the computing of the state derivative. This task may be taken independently from the rest of the program, and a separate module eg deriv.m may be used to do the calculation. The module will accept a value of time, and the corresponding value of the state at that time instant, and will return the state derivative. Second independent task is the integration step, using Euler's formula. A similar module eg euler.m can be assigned to do this task. The required inputs to this module are the previous state information, the step size, and the computed state derivative indeed the state derivative module can directly accessed by this module Thus the architecture described above can be illustrated in the figure below: In the lab, you are expected to complete the following list of TASKS: for YOUR REPORT PLOT so that your numerical solution and this can be compared in one plot. Complete the programs described in Figure For a step size of run your code for minutes and plot the concentration vs time on
Part
It is asked to solve for the dynamics of the model in part with respect to time, using both analytical and numerical approaches, and a comparison between the two approaches be offered.
Numerical Solution:
A modular and flexible programming approach is adopted in this assignment, and students will be encouraged to continue using this approach throughout the course. When designing a numerical implementation of the proposed solution, first an architecture should be decided upon. We would like this architecture to be modular, ie consisting of separate modules that performs unrelated tasks. This will prove to be useful for later assignments, when the student needs a module that just does the task.
& main program
handle variable assignment
discretize the solution interval
set up time loop for loop
plot results in a graph
main.m
main
call
function ckeuler
deriv
call
euler.m
function deriv
your derivative function
deriv.m
Figure Schematic diagram of the model
Take the architecture proposed in Figure for example, the main program mainm that takes care of inputoutput assignment of variables, discretization of solution interval, and setting up an incremental solution scheme a loop over time that starts from to where denotes the final solution time The presentation of results in graphical andor tabular formats is also done here. Within the loop over time inside this main program, certain tasks need to be performed each step, such as calculation of the state derivative, or the integration performed according to Euler's formula,
where refers to the step size between two increments in time.
Now let's investigate how these this task will be performed.
First consider the computing of the state derivative. This task may be taken independently from the rest of the program, and a separate module eg deriv.m may be used to do the calculation. The module will accept a value of time, and the corresponding value of the state at that time instant, and will return the state derivative.
Second independent task is the integration step, using Euler's formula. A similar module eg euler.m can be assigned to do this task. The required inputs to this module are the previous state information, the step size, and the computed state derivative indeed the state derivative module can directly accessed by this module Thus the architecture described above can be illustrated in the figure below:
In the lab, you are expected to complete the following list of TASKS: for YOUR REPORT
PLOT so that your numerical solution and this can be compared in one plot.
Complete the programs described in Figure
For a step size of run your code for minutes and plot the concentration vs time on
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started