关键词 > CENG/NANO15

CENG/NANO 15 Winter 2022 Homework 4

发布时间:2022-02-21

Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CENG/NANO 15

Winter 2022

Homework 4


Important warning!

The purpose of this assignment is for you to practice setting up and solving problems in MATLAB. All problems will use essentially the same solution approach which means you may be tempted to copy-paste code from previous problems since it will save you some typing. Please try to resist this temptation!

One of the most common things I hear in CENG 113 (a MATLAB-heavy course) is something along the lines of, “I think I did this in 15 but I don’t remember how.”  That’s certainly understandable given how much we cover in this course!

What I’m trying to do with this warning is address that feeling here, now, in CENG/NANO 15. Specifically, this warning is trying to convince you that you’ll be better served in the long run if you try your best to write out each problem all by itself–from scratch, without copy/pasting or looking at previous prob- lems, including all the plotting commands. It’ll help develop “muscle memory” not just for root finding but for your general understanding of scripts, local functions, inputs and outputs, plotting, and debugging.

Understand too that there’s no way I’ll know if you took this advice when I’m grading, therefore this isn’t a matter of getting a better or worse grade in CENG/NANO 15. The only person who will know is you, and please take my advice that your future self will appreciate the extra effort.

For each problem in this assignment,

• Create a new script called ♣r♦❜❧❡♠❳✳♠where ❳ is the number of the problem.

• Within the script use a local function and the ❢③❡r♦ function to perform the requested root finding opera- tion.

• Plot the root finding function, label your axes, and add a marker at the location of the root as we did in class.

• Use s♣r✐♥t❢ to display the root’s value in your plot title.

Problem 1

Solve the equation

21.5 = 27.14 + (9.27 × 10−3) − (1.38 × 10−5)2 + (7.65 × 10−9)3 − 8.314 for . Note that is absolute temperature so it’s also greater than 0.


Problem 2

Solve the equation

= + + 2 + 3 −

for when = 35 and

= 26.93

= 3.38 × 10−2

= −3.87 × 10−5

= 1.55 × 10−8

= 8.314.


Problem 3

At the top of your script define the variable s♣❡❝✐❡s and assign to it a value of ✬❍✷ ✬, ✬❖✷ ✬, ✬◆✷ ✬, or ✬◆❖ ✬ (the molecular formulae for hydrogen, oxygen, nitrogen, or nitric oxide). Use the remainder of the script and a local function to solve the equation

= + + 2 + 3 −

for when = 22. The coefficients , , , and must be automatically selected based on whatever s♣❡❝✐❡s is used based on the table (matrix) below. Your local function should accept two inputs, ❚ and s♣❡❝✐❡s, and the assignment of coefficients through must be made within the local function (hint: use a s✇✐t❝❤ statement). Tell ❢③❡r♦ to search only the region from = 250 to = 1200 for the root.

Species

✬❍✷ ✬        27.14       9.27 × 10−3      −1.38 × 10−5         7.65 × 10−9


✬❖✷ ✬ ✬◆✷ ✬ ✬◆❖ ✬


28.11 31.15 29.35


−3.68 × 10−6 −1.36 × 10−2 −9.38 × 10−4


1.75 × 10−5

2.68 × 10−5

9.75 × 10−6


1.07 × 10−8

−1.17 × 10−8

−4.19 × 10−9

In addition to the root’s value, also include in your plot title the value of s♣❡❝✐❡s (use ✪s within s♣r✐♥t❢ for this parameter). Your script will be tested with each of the species listed in this table so it’s to your benefit to try different values for s♣❡❝✐❡s to ensure that your script is functional.

Problem 4

Find the roots of

0.125 = sin ( − 3)

between −5 and +5, plotting all of the roots (along with the function) on the same plot. Use curly braces to add multiple lines to your title like this:

1

2

3

4


s1 = sprintf( 'line s2 = sprintf( 'line s = {s1; s2}; title(s);

%.0f in title ', 1); % change this to your first root

%.0f in title ', 2); % change this to your next root , and so on


Problem 5

For a two-stage distillation column the relationship between the bottom and top compositions ( and ) can be determined from a McCabe-Thiele (pronounced “muh-kabe tee-lee”) diagram by drawing stages (red) between the equilibrium line (blue) and 45 degree line (black) as follows:


0.8


1

The equilibrium (blue) line is given by the equation

=

If = 0.30 find the value of for which = 0.80.  In addition to the standard root finding plot (i.e., in addition to () as a function of ) also create a McCabe-Thiele diagram like the one shown above which illustrates your solution. Remember that typically ranges from about 1.5 to 4.0. Use s✉❜♣❧♦t to put these two plots side-by-side.