Problem 1-QSSA and Separation of Timescales (25 pts) (a) Using Matlab, demonstra
ID: 2080681 • Letter: P
Question
Problem 1-QSSA and Separation of Timescales (25 pts) (a) Using Matlab, demonstrate how the Quasi-Steady-State Assumption improves steady-state approximations of an open system. Using: A B k-1 Replicate the results in Figure 2.13 (page 45) and Figure 2.14 page 47 the parameter values can be found in the figure captions. (b) Using the replication of 2.14, show how the experiment's sampling time relates to the time constant of the process. For example, change the sampling time of your model to: 0.01 seconds 0.5 second 2 seconds. In your plots for part (b), only show the trace for b(tExplanation / Answer
% [X, RESNORM, F, EXITFLAG, OUTPUT, JACOB] = NEWTONRAPHSON(FUN, X0, OPTIONS) % FUN is a function handle that returns a vector of residuals equations, F, % and takes a vector, x, as its only argument. When the equations are % solved by x, then F(x) == zeros(size(F(:), 1)). % % Optionally FUN may return the Jacobian, Jij = dFi/dxj, as an additional % output. The Jacobian must have the same number of rows as F and the same % number of columns as x. The columns of the Jacobians correspond to d/dxj and % the rows correspond to dFi/d. % % EG: J23 = dF2/dx3 is the 2nd row ad 3rd column. % % If FUN only returns one output, then J is estimated using a center % difference approximation, % % Jij = dFi/dxj = (Fi(xj + dx) - Fi(xj - dx))/2/dx. % % NOTE: If the Jacobian is not square the system is either over or under % constrained. % % X0 is a vector of initial guesses. % % OPTIONS is a structure of solver options created using OPTIMSET. % EG: options = optimset('TolX', 0.001). % % The following options can be set: % * OPTIONS.TOLFUN is the maximum tolerance of the norm of the residuals. % [1e-6] % * OPTIONS.TOLX is the minimum tolerance of the relative maximum stepsize. % [1e-6] % * OPTIONS.MAXITER is the maximum number of iterations before giving up. % [100] % * OPTIONS.DISPLAY sets the level of display: {'off', 'iter'}. % ['iter'] % % X is the solution that solves the set of equations within the given tolerance. % RESNORM is norm(F) and F is F(X). EXITFLAG is an integer that corresponds to % the output conditions, OUTPUT is a structure containing the number of % iterations, the final stepsize and exitflag message and JACOB is the J(X). % % See also OPTIMSET, OPTIMGET, FMINSEARCH, FZERO, FMINBND, FSOLVE, LSQNONLIN % % References: % * http://en.wikipedia.org/wiki/Newton's_method % * http://en.wikipedia.org/wiki/Newton's_method_in_optimization % * 9.7 Globally Convergent Methods for Nonlinear Systems of Equations 383, % Numerical Recipes in C, Second Edition (1992), % http://www.nrbook.com/a/bookcpdf.php % Version 0.5 % * allow sparse matrices, replace cond() with condest() % * check if Jstar has NaN or Inf, return NaN or Inf for cond() and return % exitflag: -1, matrix is singular. % * fix bug: max iteration detection and exitflag reporting typos % Version 0.4 % * allow lsq curve fitting type problems, IE non-square matrices % * exit if J is singular or if dx is NaN or Inf % Version 0.3 % * Display RCOND each step. % * Replace nargout checking in funwrapper with ducktypin. % * Remove Ftyp and F scaling b/c F(typx)->0 & F/Ftyp->Inf! % * User Numerical Recipies minimum Newton step, backtracking line search % with alpha = 1e-4, min_lambda = 0.1 and max_lambda = 0.5. % * Output messages, exitflag and min relative step. % Version 0.2 % * Remove `options.FinDiffRelStep` and `options.TypicalX` since not in MATLAB. % * Set `dx = eps^(1/3)` in `jacobian` function. % * Remove `options` argument from `funwrapper` & `jacobian` functions % since no longer needed. % * Set typx = x0; typx(x0==0) = 1; % use initial guess as typx, if 0 use 1. % * Replace `feval` with `evalf` since `feval` is builtin. %% initialize % There are no argument checks! x0 = x0(:); % needs to be a column vector % set default options oldopts = optimset( ... 'TolX', 1e-12, 'TolFun', 1e-6, 'MaxIter', 100, 'Display', 'iter'); if narginfold+ALPHA*lambda*slope if lambda==1 lambda = -slope/2/(f-fold-slope); % calculate lambda else A = 1/(lambda1 - lambda2); B = [1/lambda1^2,-1/lambda2^2;-lambda2/lambda1^2,lambda1/lambda2^2]; C = [f-fold-lambda1*slope;f2-fold-lambda2*slope]; coeff = num2cell(A*B*C); [a,b] = coeff{:}; if a==0 lambda = -slope/2/b; else discriminant = b^2 - 3*a*slope; if discriminantRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.