Question

Write a MATLAB code to read the following data sample of fluid properties. 1.       Read data...

Write a MATLAB code to read the following data sample of fluid properties.

1.       Read data from an input file to run the program. The format of the data file is given below.

Format of input file

# of components (integer)

????,1, ????,1 ,??1, ??1 (critical temperature (K), critical pressure (bar), acentric factor, mole fraction for component 1)

[optional lines for additional component if the number of components is greater than 1, for components 2 up to 5]

T (system temperature, K)

P (system pressure in bar)

Sample file for acetic acid and 1-propanol, equimolar mixture at 385 K and 12.5 bar:

2

594.4 57.86 0.454 0.5

536.7 51.68 0.624 0.5

385

12.5

Check if the molar fraction adds up to 1, if not display error.

Homework Answers

Answer #1

Program:

clc
clear all
n=input('enter number of components')

for i=1:n
disp(i,'component')
Tc=input('critical temperature')
Pc=input('critical pressure')
a=input('accentric factor')
x(i)=input('mole fraction of component(i)')
end

output:

enter number of components 2

component

1.  
critical temperature 594.4
critical pressure 57.86
accentric factor 0.454
mole fraction of component 0.5

component

2.  
critical temperature 536.7
critical pressure 51.68
accentric factor 0.624
mole fraction of component 0.5
system temperature 385
systempresure 12.5

T=input('system temperature')
P=input('systempresure')

output:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a program that does the following in C++ 1 ) Write the following store data...
Write a program that does the following in C++ 1 ) Write the following store data to a file (should be in main) DC Tourism Expenses 100.20 Revenue 200.50 Maryland Tourism Expenses 150.33 Revenue 210.33 Virginia Tourism Expenses 140.00 Revenue 230.00 2 ) Print the following heading: (should be in heading function) Store name | Profit [Note: use setw to make sure all your columns line up properly] 3 ) Read the store data for one store (should be in...
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's...
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's algorithm to ensure mutual exclusion in the respective critical sections of the two processes, and thereby eliminate the race condition. In order to implement Peterson's Algorithm, the two processes should share a boolean array calledflagwith two components and an integer variable called turn, all initialized suitably. We will create and access these shared variables using UNIX system calls relating to shared memory – shmget,...
READ THE CASE STUDY AND ANSWER THE FOLLOWING QUESTIONS 2nd CASE: An Unexplained Death A 65-year-old...
READ THE CASE STUDY AND ANSWER THE FOLLOWING QUESTIONS 2nd CASE: An Unexplained Death A 65-year-old man of Scandinavian descent was rushed to the Emergency Room of your local hospital after a family member discovered him unconscious in his home. The woman who dialed “911” told the dispatcher that the man, her brother, was the local librarian of the past 10 years and had no spouse or children. She reported that they had spoken the day before, and he had...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary rivals? How will the acquisition of Reebok by Adidas impact the structure of the athletic shoe industry? Is this likely to be favorable or unfavorable for New Balance? 2- What issues does New Balance management need to address? 3-What recommendations would you make to New Balance Management? What does New Balance need to do to continue to be successful? Should management continue to invest...