#### MATLAB files

Download these files to follow along with the screencasts or just for your use.

Bootcamp 1

Bootcamp 2

Bootcamp 3

Bootcamp 1

Text-based data files

###### FurnaceData.txt (tab delimited) – text file with furnace fuel rate and CO_{2} flue gas concentration

H2SO4VaporPressure.txt (tab delimited) – text file with vapor pressure of concentrated sulfuric acid versus temperature

__MATLAB Script Files__

###### barchartexample.m – example bar chart: world energy supply by source, Pareto format

breakexample.m – example of the use of the break statement in a for loop

cart_to_polar.m – user-defined function to convert Cartesian coordinates to polar coordinates

ClampX_Example.m – example script using the multialternative if structure to clamp or limit a variable

continueexample.m – example of the use of the continue statement in a for loop

###### contourplotexample1.m – contour plot of analytical function with labeled contours

datawithmarkersplot.m – simple plot of data with markers and interconnecting lines

figurewindowexample1.m – example of creating two separate figure windows using furnace data

figurewindowexample2.m – creating multiple subplots in a single figure window

humpsplot.m – simple line plot of the humps function

###### InputExamples.m – example scripts using the input function

logplotexample.m – semilog plot of H_{2}SO_{4} vapor pressure data versus temperature

MAD1.m – for loop example to compute the median absolute deviation (MAD)

MAD2.m – vector/matrix example to compute the median absolute deviation (MAD)

nestedloopsexample.m – example of the use of two nested loops to set the indices of a matrix

###### OneLineIfExample.m – example script using the one-line version of the one-way if statement

OneWayIfExample.m – example script using the one-way if/then statements

PengRobinsonMethaneExample.m – script with comments to compute pressure using the Peng-Robinson equation of state

piechartexample.m – pie chart of wind energy data by country

randomnumberplot.m – simple plot of 5,000 random numbers

###### SaltSolutionsContourPlot.m – contour plot of NaCl data

SaltSolutionsPlotExample.m – plot of multiple curves using NaCl density data versus wt% and temperature

surfaceplotexample.m – surface plot of analytical function

SwitchExample.m – example script using the switch select-case structure

twinaxesplotexample.m – plot using both left and right vertical axes scale, using the furnace data

###### TwoWayIf_Example.m – example script using the two-way if/then/else statements

WhileLoop1.m – use of a while loop to implement the Newton-Raphson method with while exit condition

WhileLoop2.m – use of a while loop with a break statement to implement the Newton-Raphson method

Bootcamp 2

Text-based data files

###### H2SO4VaporPressure.txt (tab delimited) – text file with vapor pressure of concentrated sulfuric acid vs temperature

__MATLAB Script Files__

###### Absorber.m – solution of linear equations for a six-stage absorber

Antoine.m – function to compute sum of squares of errors for Antoine Equation

batch.m – function to provide derivative for single-equation batch reactor model

batchDAE.m – function to provide derivative and algebraic equation errors for batch reactor model

bincon.m – function to compute constraint errors for conical bin optimization

###### bisect.m – function for the bisection method

bisect_test.m – script to test the bisection method

bisect1.m – function for the bisection method with iteration limit optional argument

bisect1_test.m – script to test the bisect1 function

DensityModel.m – script to plot density of methanol-water solutions vs wt% methanol

###### derivs.m – function to provide derivatives for two differential equation examples

diffeqs.m – function to provide derivatives for second order ODE

f.m – example function for solution using the fzero function

findmax.m – script to find a maximum of the humps function using fmaxbnd

findmin.m – script to find a minimum of the humps function using fminbnd

###### fn.m – example function for bisection solution

fwg.m – function to compute equation error for water-gas equilibrium equation

fx.m – function to compute water-gas shift equation error with feed arguments

fzero_example.m – script to solve for root using the fzero function

H2SO4AntoineEqn.m – script to carry out nonlinear regression of Antoine equation using fminunc

###### htexr.m – function to provide derivative values for tube-in-tube heat exchanger

humps.m – function to compute humps equation value

humps1.m – function to compute the negative of the humps equation value

multibatch.m – function to provide derivatives for multi-component batch reactor model

NaClDensityRegression.m – script to regress model of NaCl-H2O density data using fitlm function

###### NaClDensityRegressionMatrixCalcs.m – script to regress quadratic response model of NaCl-H2O density data using matrix calculations

optbin.m – script to sole for optimal design of conical bin using fmincon

parasite.m – initial attempt at solving a differential equation with a parasitic solution

parasite1.m – successful attempt at solving a differential equation with a parasitic solution

plothumps.m – script to plot the humps function

###### quadrature.m – script to find area under a curve using the integral function

S.m – function to computer surface area of conical bin

SolveBatchReactor.m – script to solve single-equation batch reactor model using ode45

SolveBatchReactorDAE.m – script to solve single-equation batch reactor model as a DAE using ode15s

SolveMultiBatchDAE.m – script to solve multiple reaction batch reactor model as a DAE using ode15s

###### solvemultipleODEs.m – script to solve two differential equations using ode45

solveODEs.m – function to provide equation error for heat exchanger hot outlet temperature

solvesplitboundary.m – script to solve split boundary ODEs and plot solution

SolveStmEquil.m – script to solve steam/water equilibrium equations using fsolve

splitboundary.m – trial solution of second-order ODE with split boundary conditions

###### splitboundary1.m – function to solve split boundary ODEs with initial condition argument

stdnormcumprob.m – quadrature of standard normal distribution function using the integral function

stdnormdens.m – function to compute density of standard normal distribution

SteamEqn.m – function to compute equation errors and Jacobian for steam/water equilibrium

testtrapz.m – script to compute quadrature of a set of data using the trapz function

###### tube_in_tube_heat_exchanger.m – script to solve heat exchanger with estimate for hot outlet temperature

tube_in_tube_heat_exchanger_fzero.m – script to solve heat exchanger using fzero to satisfy split boundary condition

V.m – function to compute volume of conical bin

WaterGasCaseStudy.m – script to plot the water-gas shift equation error

WaterGasShiftCaseStudyWithPlot.m – script to solve the water-gas shift equation using bisection

###### WaterGasShiftCaseStudyWithPlotWithfzero.m – script to solve the water-gas shift equation using the fzero function

Bootcamp 3

__Ammonia PBR Model__

###### AmmoniaModelComparison.m – script to compare the simplified and full model solutions for the ammonia reactor

AmmoniaPBRSimulationFullModel.m – script to solve the full model of the ammonia packed-bed reactor

fH.m – function to compute the enthalpy equation error given a temperature

FindT.m – function to find reaction temperature given enthalpy using the secant method

AmmoniaPBRSimplified.m – script to solve the simplified model of the ammonia packed-bed reactor

###### HtCap.m – function to compute component heat capacity as a function of temperature

HtRxn.m – function to compute heat of reaction for ammonia as a function of temperature

HtRxnP.m – function to compute heat of reaction for ammonia as a function of temperature and pressure

PBRSimplified.m – function to compute derivatives for the simplified model of the ammonia packed-bed reactor

PBRsysFullModel.m – function to compute derivatives for the full model of the ammonia packed-bed reactor

###### PR.m – function to compute the equation error for the Peng-Robinson equation of state

SpecVol.m – function to solve the Peng-Robinson equation of state to find the specific volume

__Acetone Cracking PFR Case Study__