Question: This is a matlab program question: So here is my script file: %% %Problem 3 composition = importdata('gascomp.txt');%import for i = 1:5 compi=composition(i,:); [total_energy]=Class24_funcb(compi); fprintf('The

This is a matlab program question:

This is a matlab program question: So here is my script file:%% %Problem 3 composition = importdata('gascomp.txt');%import for i = 1:5 compi=composition(i,:); [total_energy]=Class24_funcb(compi);So here is my script file:

%%

%Problem 3

composition = importdata('gascomp.txt');%import

for i = 1:5

compi=composition(i,:);

[total_energy]=Class24_funcb(compi);

fprintf('The total energy of mixture %d is %d.',i,total_energy)

if total_energy>7000

fprintf('Mixture %d has total energy over 7000.',i)

end

end

I need to understand how to implement the function file into this script file. Please write up what the function file should be made of, and show the command window.

Here is the gascomp.txt:

2.4 1.3 0.5 0.8

2.9 0.2 1.4 0.5

1.1 1 2.3 0.6

3.4 0.4 0.4 0.8

2 1 1 1

Problem 3 Background Chemical engineers would be concerned with the energy available when mixtures of gas are combusted. Problem Statement You are a chemical engineer looking at four gases: methane, ethane, propane and butane in a mixture. You have already done a composition analysis on 5 mixtures and the number of mols of each gas was written to the file gascomp.txt. The first column corresponds to Methane, the second Ethane, the third Propane, and the fourth column is Butane. Each gas mixture was 5.0 mol total. In a function file calculate energy output when each mixture is combusted. The input variables will be the mols of each of the 4 gases in that mixture. The output variable will be the total energy (kJ) Energy of combustion of four gases given in table below

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!