Question: Consider the following ODE - IVP: d y d t = y ( - 2 - 5 y - y 2 ) + 0 .
Consider the following ODEIVP:
tin
that represents a CSTR with a fluctuating feed stream and a secondorder reaction. This is very closely related to the problem introduced in
Section in Dorfman and Daoutidis.
Part a
Write a MATLAB program that solves this problem numerically using RK This function should take as input the initial condition
stepsize and the final time and automatically generate a labeled plot of Test this function for and report your results.
Implement your main RK function at the bottom, call your function and
plot the results using code here
Common constants:
t i initial time to start integrating from
y i initial condition
tf ; final time to stop integrating
h ; given stepsize
call the RK function to solve the problem numerically
plot the results and comment on them
Part b
Write a function that applies linear stability analysis to determine the maximum stepsize required for stability at the current time Using
this function, determine the maximum stepsize so that the system is stable at the first step.
Implement your main stability function at the bottom, call your function
here to calculate h
Part c
Using your code RK code from Part a write a program that generates two plots: a plot of the maximum stepsize versus and a plot
of the numerical solution of versus for and on a single plot For full credit, don't forget to comment on
your findings.
call the RK function for the three different h values and plot the
results on the same plot.
call the stability function at each integration step to calculate the
maximum stepsize at each timestep over the horizon and plot the results
Comment on results:
Common Functions
function ty RKttfyh
implement the RK algorithm and output a vector of t and y for plotting
end
function hs stability
calculates the maximum stepsize h based on the linear stability
criterion
end
function f funty
evaluates the righthand side function for the RK algorithm
end
Problem Consider the following ODEIVP:
tin
that represents a CSTR with a fluctuating feed stream and a secondorder reaction.
a Write a MATLAB program that solves this problem numerically using RK This function
should take as input the initial condition stepsize and the final time and
automatically generate a labeled plot of Test this function for and report your
results.
b Write a function that applies linear stability analysis to determine the maximum stepsize
required for stability at the current time Using this function, determine the maximum
stepsize so that the system is stable at the first step.
c Using your code from Part a write a program that generates two plots: a plot of the
maximum stepsize versus and a plot of the numerical solution versus for
and on a single plot For full credit, don't forget to comment on
your findings.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
