Spring 2013
ChE 310 Computational Methods for Chemical Engineers
171 Durham Hall & Sweeney 1123
TR 2:10pm 3:30pm
(110 Points Total)
Homework Set #3 Due 5:00pm Tuesday, February 12, 2013
hw3.1 Matrix Multiplication
(25 Points)
Consider the multiplication o
ChE 310 Computational Methods for Chemical Engineers
171 Durham Hall & Sweeney 1123
TR 2:10pm 3:30pm
(80 Points Total)
Spring 2013
Homework Set #2 Due 5:00pm Tuesday, February 2, 2013
hw2.1 Write an m-file script called hw2_1.m that automatically creates
Spring 2013
ChE 310 Computational Methods for Chemical Engineers
171 Durham Hall & Sweeney 1123
TR 2:10pm 3:30pm
(110 Points Total)
Homework Set #3 Due 5:00pm Tuesday, February 12, 2013
hw3.1 Matrix Multiplication
(25 Points)
Consider the multiplication o
ChE 310 Computational Methods for Chemical Engineers
171 Durham Hall & Sweeney 1123
TR 2:10pm 3:30pm
(80 Points Total)
Spring 2013
Homework Set #2 Due 5:00pm Tuesday, February 2, 2013
hw2.1 Write an m-file script called hw2_1.m that automatically creates
Spring 2013
ChE 310 Computational Methods for Chemical Engineers
171 Durham Hall & Sweeney 1123
TR 2:10pm 3:30pm
(30 Points Total)
Homework Set #5 Due 5:00pm Friday, March 1, 2013
hw5.1 Redo hw4_1f, this time by writing the root-nding function as VBA code
ChE 310 Computational Methods for Chemical Engineers
171 Durham Hall & Sweeney 1123
TR 2:10pm 3:30pm
(100 Points Total)
Spring 2013
Homework Set #4 Due 5:00pm Tuesday, February 19, 2013
hw4.1 Multicomponent Vapor-Liquid Equilibrium
(100 Points Total)
A fl
Spring 2013
ChE 310 Computational Methods for Chemical Engineers
TR 2:10pm 3:30pm
171 Durham Hall & Sweeney 1123
January 15, 2013
Class Meeting #1
Matlab Matlab Matlab
Save each problem using the command diary:
5
> diary hw1_1a . txt % Save everything I
Spring 2013
ChE 310 Computational Methods for Chemical Engineers
TR 2:10pm 3:30pm
171 Durham Hall & Sweeney 1123
Course Instructor/Homework-Grader E-mail: che310admin@iastate.edu
Please use this email address for all grade-related communication.
Instructo
clear;
load hw4_1;
x
y
X
Y
Z
= %mxn interpolated x values
= %mxn interpolated y values
=
=
=
H_downsampled = H(1:8:emd); %take elements
0ont believe i need to downsample data
%use interp1 function for interpolation
H_inerp = linspace(min(H),max(P),100);
P
% ic7_1a : plot the flash tank problem and solve with fzero
z = [0.8345 0.0046 0.0381 0.0163 0.0050 0.0074 0.0287 0.0220 0.0434];
K = [3.0900 1.6500 0.7200 0.3900 0.2100 0.1750 0.0930 0.0650 0.0360];
F = 100; %mol/h
%root-finding function
f = @(V) 1 - sum
clear, clc;
function result = matrix_maker(m,n)
m = input('Input the number of rows in the matrix');
n = input('Input the number of columns in the matrix');
if m <= 0 or n <= 0
error('Error, number must be greater than zero')
end
ii = 1:m;
jj = 1;n;
for i
Spring 2013
ChE 310 Computational Methods for Chemical Engineers
171 Durham Hall & Sweeney 1123
TR 2:10pm 3:30pm
(135 Points Total)
Homework Set #7 Due 5:00pm Friday, March 15, 2013
hw7.1 Setting up a linear system of equations
(95 Points
Total)
Consider
Spring 2013
ChE 310 Computational Methods for Chemical Engineers
171 Durham Hall & Sweeney 1123
TR 2:10pm 3:30pm
(150 Points Total)
Homework Set #5 Due 5:00pm Friday, March 8, 2013
hw5.1 A 1 L batch reactor initially contains 1 mol of A and 1 mol of B. Th
1. How would you go about re-writing the following expression into its root-finding form
for use with Excel macros?
2
x +3 x=tan (x)+
a.
x 2+3 xtan (x)=
b.
x 2+3 xtan (x) =0
c.
x +3 x +tan ( x)+ =0
2
d. No change necessary
e. None of the above
2. The clo
1. Using Nave Gaussian Elimination, how would you solve L d = b and U x = d?
a. Forward substitution for L d = b and backward substitution for U x = d
b. Backward substitution for L d = b and forward substitution for U x = d
c. Forward substitution for bo
1. True or False: An M-file includes both script files and function files
a. True
b. False
2. Which of the following is true regarding loops?
a. Only for loops require the end syntax to execute a loop command
b. A for loop repeats statements a specific nu
1. When using the macro-enabled solver in Excel to solve non-linear equations such as the
Redlich-Kwong Equation of State to find the volume:
Which of the following should be set equal to zero in order to solve for volume?
a.
b.
c.
d.
e.
Actual pressure l
1. For cell arays of strings, which punctuation should be used?
a. ( )
b. [ ]
c. cfw_
d. < >
e. None of the above
2. In creating a function_handle, which of the following is formatted correctly?
a. F = @(x) (x . ^ 2)
b. F = (x) (x . ^ 2)
c. F = @(x) (x ^
Spring 2013
ChE 310 Computational Methods for Chemical Engineers
171 Durham Hall & Sweeney 1123
TR 2:10pm 3:30pm
(30 Points Total)
Pre-meeting Exercise for Class Meeting #9 at 2:10pm Tuesday, February 12, 2013
Please read lecture note module 4, and then c
Spring 2013
ChE 310 Computational Methods for Chemical Engineers
TR 2:10pm 3:30pm
171 Durham Hall & Sweeney 1123
(50 Points total)
Challenge Problem #1
ch1.1 How does fzero Work?
Dekker's Method for Solving Non-linear equations
(50 Points)
The Matlab buil
function [r, theta] = cart2polar(x,y)
n = length(x);
m = length(y);
if n ~= m
error('n must equal m')
end
r = zeros(1,lenth(x);
theta = zeros(1,length(y);
for i = 1: n
r(i) = sqrt(x(i).^2 + y(i).^2);
if x(i) > 0 & y(i) > 0
theta(i) = atan(x(i)/y(i);
Lecture 14 October 12, 2010
Agenda:
Solving systems of non-linear equations
Newton-Raphson (multiple equation version)
MATLAB built-in root finding methods
fzero (any function)
roots (any polynomial)
Systems of Non-linear Equations
Often, well need
Lecture 13 October 7, 2010
Agenda:
Solving Non-linear functions: f(x) = 0 (root finding)
Closed (Bracketing) Methods
o Bisection (talked about this last time)
o False Position
Open Methods (non-bracketing)
o Newton-Raphson
o Secant
Discuss HW 3 (due 1
Lecture 12 October 5, 2010
Agenda:
Exam 1 Discussion
Solving Non-linear functions: f (x) = 0 (root finding)
Introduction
Graphical Methods
Bracketing Methods
o Incremental Search
o Bisection
Business Items
In-Class Exercises:
Should be done the sam