##

(Solved) Read all instructions before beginning your work. COMP1200- MATLAB - Assign 03 Due 11:59 pm - Friday - February 10, 2017 Submit assign03.m via Canvas...

have a lot of question about this program just looking for where to startÂ

Read all instructions

before beginning your work. COMP1200- MATLAB - Assign 03

Due 11:59 pm â€“ Friday â€“ February 10, 2017

Submit assign03.m via Canvas Substance a (L2 atm/mol2) b (L/mol) He 0.0341 0.0237 H2 0.244 0.0266 O2 1.36 0.0318 H2O 5.46 0.0305 CCl4 20.4 0.1383 NOTE:

Your submitted file(s) MUST be

spelled and cased as instructed. Problem:

In 1873, Johannes Diderik van der Waals proposed a version of the ideal gas law that models the behavior of real gases over a

wide range of temperature and pressure than previous equations. The ideal gas law describes the relationships between pressure (p),

absolute temperature (T), volume (V) and the number of moles of gas (n). The additional symbol, R, represents the ideal-gas

constant. In this equation, the additional variables a and b represent values characteristic of individual gases.

The Ideal Gas Law is one of the Equations of State. Although the law describes the behavior of an ideal gas, the equation is

applicable to real gases under many conditions, so it is a useful equation to learn to use. PV = nRT

Instructions for all assign scripts:

See Standards for Documentation of MATLAB Programs on the Canvas Resources page.

Insert comments at the top and throughout each file.

o Include the follow comments at the beginning of this (and ALL) files.

% submitterâ€™s name, GROUP #

Grade of ZERO for files with submitter name

not part of Canvas group. Not in a group? GROUP# is â€œnoneâ€.

% other group membersâ€™ names

For your own protection, type â€œnoneâ€ if submitting alone.

% program file name, ex. assign02a.m ALL STUDENTSâ€™ NAMES MUST MATCH NAMES ON CANVAS.

% due date of the assignment

% statement(s) about collaboration

Zero points for comments if no collaboration statement

% a short narrative about what the file does

o Use the algorithm given as comments throughout your program.

-5 points for absence of any of

Observe the instructorâ€™s rule for naming variables.

these required comments at the

o Use ALL CAPS for constants variable names.

top at the top of each file.

o Start other variables with lower case.

o Use descriptive variable names.

If you do not submit individually, there

Use Sample Input/Output as a guide.

will be

Code clarity:

a 5 POINTS PENALTY for not joining a

o Indent blocks as needed. Use Smart Indent.

group on Canvas.

o Divide your solution program code into sections as noted in the algorithm.

Groups can be 2-4 students.

Use blank lines as needed to group statements.

DO NOT join a group unless you have

worked with the other members. If you do,

o Use section comments as well as the algorithm step comments.

you will be removed from the group and

Use comments to show units.

given the grade of zero.

Use clc, clear all to clear previous run output.

Use the CONSTANT and variable names; not numbers.

No extra output use, i.e. use semicolons COMP1200m â€“ 2017sp â€“ assign03 â€“ p. 1 of 3 Program: assign03.m

Calculate the pressure exerted by 2 mol of water vapor (steam) in a 1 L container at 2000 F using the Van der Waalsâ€™ equation

and the Ideal Gas Law equation. What is the difference between the non-ideal and ideal gases?

temperature

moles, n

volume, V

ideal gas constant, R 2000 F

2 mol

1L

0.08314472 L atm/K mol Save gasValues.txt in the folder where you save your assign03.m. load() will look in the current directory for the

data file. You may want to save one of your assign02 files as assign03.m and edit it.

Write a MATLAB program that

(1) reads the a (1st column) and b (2nd column) values from a text file, gasValues.txt, using load(). You do not know how

many gasses are in the file, i.e. you do not know how many rows are in the matrix.

(2) computes the results of Van der Waalsâ€™ equation (3rd), the Ideal Gas Law equation (4th), and the difference between them (last)

(3) add results as columns to the gasValues matrix

(4) sort the gasValues matrix descending order by the Waals pressure column.

(5) refer to the output below for the number of decimal places needed line spacing.

Problem Constants: (with units)

R

0.08314472 % ideal gas constant in L atm/K mol

Problem Inputs: (with units)

temperature

% Fahrenheit

moles

% mol

volume

% L

a

% L2atm/mol2

b

% L/mol New commands:

load()

colon notation

./

location of a matrix value, indexing

colon notation for a column

size()

sortrows(), descending

format()

short, bank, loose

use disp not fprintf Problem Outputs: (with units)

Waals pressure

% atmosphere

ideal pressure

% atmosphere

difference as a positive value

Other variables: (with units)

absolute temp

% Kelvin

gas value matrix

sorted gas value matrix

number of rows

Equations:

See above.

C = (F-32) / 1.8

K = C + 273.15 Think about.

How do you build this column?

How do you know how many

numbers to put in it?

Hint: size() Output: Input file: original gasValues matrix

0.0341

0.0237 238.4021

0.2440

0.0266 239.0237

1.3600

0.0318 237.2253

5.4600

0.0305 220.1533

20.4000

0.1383 232.5163 227.2317

227.2317

227.2317

227.2317

227.2317 11.1703

11.7920

9.9935

7.0784

5.2846 a and b values for all gases

He

H2

O2

0.0341

0.2440

1.3600 H2O

5.4600 CCI4

20.4000 0.0305 0.1383 0.0237 0.0266 0.0318 The pressure (atm) using Van der Waals equation:

238.40

239.02

237.23 220.15 232.52

COMP1200m â€“ 2017sp â€“ assign03 â€“ p. 2 of 3 The pressure (atm) using Ideal Gas Law:

227.23

227.23

227.23 227.23 227.23 Difference between Waals and ideal pressure values (atm)

11.17

11.79

9.99

7.08 5.28 gasValues sorted by Waals pressure:

0.2440

0.0266 239.0237 227.2317

0.0341

0.0237 238.4021 227.2317

1.3600

0.0318 237.2253 227.2317

20.4000

0.1383 232.5163 227.2317

5.4600

0.0305 220.1533 227.2317 11.7920

11.1703

9.9935

5.2846

7.0784 Information about the last gas in the sorted matrix

a

b

non-ideal ideal

difference

5.4600

0.0305 220.1533 227.2317

7.0784 Algorithm: Last row. You do not know the row number.

DO NOT use â€œendâ€. See â€œsize()â€. Type the following algorithm as comments in the editor window.

Use the comments as a guide to type the MATLAB statements. clc, clear all

%*****CONSTANT*****

%*****INPUT*****

% Get inputs Get input variables as given in instructions

% Read a and b values from gasValues.txt text file into matrix gasValues

%*****COMPUTE*****

% Convert F temp tp absolute temp K

% Compute Van der Waals pressure

% Store values in the 3rd column of gasValues matrix

% Compute ideal pressure

% Store values in the 4rd column of gasValues matrix

% Compute the difference between Waals pressure and ideal pressure

% Store values in the 5th column of gasValues matrix

% Sort matrix by Waals column in descending order

%*****OUTPUT*****

% Display original gasValues matrix

% Display a and b horizontally under the names of the gases.

% Display Waals pressure values

% Display ideal pressure values

% Compute the difference between Waals pressure and ideal pressure

% Display matrix sorted by Waals pressure column, descending order

% Display the information about the last gas in the sorted matrix Submit via Canvas:

assign03.m MATLAB program file NOTE:

Your submitted file(s) MUST be

spelled and cased as instructed. COMP1200m â€“ 2017sp â€“ assign03 â€“ p. 3 of 3

**Solution details:**
This attachment is locked

We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free solution (Deadline assured. Flexible pricing. TurnItIn Report provided)

×
Please Enter Your Payment Email Address To Receive Solution.