Working with Arrays

This exercise asks you to write a program to give you some experience of working with arrays, vectors and matrices in MATLAB. However, you must make sure your program is reusable, and you should ensure that it can be used to solve systems with different numbers of components.

Calculating the properties of streams

A stream consists of a set of components for which we have the following information:

You are to write a program which, given this information for a particular stream, calculates and outputs the following properties:

  1. F, the total flow, in kmol/s, of the stream where:

    and where nc is the number of components in the stream.
  2. wi, the mass flow of each component in kg/s, where:
  3. W, the total mass flow:
  4. and xi, the mole fraction of each component, where:

Try this program out for the following 5 component stream:

  1. 0.1 kmol/s of Propane, molecular weight 44.1 kg/kmol
  2. 0.2 kmol/s of Butane, molecular weight 58.1 kg/kmol
  3. 0.08 kmol/s of Pentane, molecular weight 72.2 kg/kmol
  4. 0.3 kmol/s of Hexane, molecular weight 86.2 kg/kmol
  5. 0.025 kmol/s of Heptane, molecular weight 100.25 kg/kmol

Now run your program to solve the same problem but for a 6 component stream which is the same as the one above but with one other component: 0.13 kmol/s of Water, molecular weight of 18.

Hint : You should use the input function to request the mass flowrates and molecular weights of each component.