File Exchange

image thumbnail

Selection of Optimum Chemical Reactor Design

version (3.08 KB) by Housam Binous
Select optimum reactors' configuration


Updated 28 Dec 2007

No License

The program allows one to choose the best reactor setup among three alternatives: (1) a plug flow reactor with recycle, (2) a combination of a plug flow reactor and a stirred tank reactor in series and (3) two stirred tank reactors in series. This problem was solved graphically by O. Levenspiel in Chemical Reaction Engineering, 3rd Edition, Wiley, 1999 (Example 6.3 page 144). In the present program, we show how one can accurately solve the same problem with the numerical and graphical capabilities of Matlab. We find similar results and conclusions as the ones given by Professor Levenspiel. In fact, it is configuration (2) that gives the smallest size of reactors.

A similar treatment using Mathematica can be found in the following link:

Cite As

Housam Binous (2020). Selection of Optimum Chemical Reactor Design (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (10)


sir, its very help me
thank u


Hello sir
Thanks you so much
best wishes

Hello Mr.Binous,

I'm an old student from your institute (INSAT) and I would like to congratulate you about your effort in developing new modelling tools for students.

Thank you
E-mail: moha(dot)jelassi(at)gmail(dot)com.

zaidoon mohsin

Dear sir
I need you to send me nay papers articles and comments considering with matlab using in chemical engieering

John D'Errico

Then make your codes more useful to those same students. As it is, you have improved your coding style over what it was a year or so ago. There is still room for improvement.

It is good that I sometimes see functions used in your codes where I would have seen scripts before.

It is good that you are now adding comments in some places in your code.

It is good that there are axis labels on your figures.

It is good that we see references provided.

These are all good things that you are doing.

What can be improved:

Use semi-colons after your lines. As I read through your codes again, I see that a significant fraction of the lines have no semi-colons, for no good reason. This just dumps out random, confusing garbage to the command window.

Provide units in your comments. When a student sees a number like 0.1, even if they know it is perhaps a rate or a mass, what are the units used here? The mere assumption that a number is in SI units is still not adequate to tell them anything.

Add comments before you call a function like fsolve. For example, I see the following line in your code:

Y=fsolve(@zeroreact,[2 6])

What is being solved for here? What are you solving? Add a comment that explains what you did.


Yes, I'd like to see better programming practices in general. The heavy use of global variables and scripts is a good example, as you encourage the student to do something that is poor. The bad habits that they learn from you will stay with them for years afterwards. On the other hand, if the only thing that you ever did "wrong" was to use a global variable, I'd still be willing to give a code a warm appraisal if the rest of it was good.

Housam Binous

My intention is not to teach good and fancy skills in programming but rather to show how a simple few line code written in a couple of hours with Matlab can solve a specific chemical engineering problem that might seem daunting to students. Again, I apologize to people who are more interested in syntax and style; I am not a programmer but a simple chemical engineer faculty trying to make use of Matlab.

John D'Errico

These submissions might be useful if the author tried, but they are just rather poor as is. There is sparse help and sparse explanations of what was done. Where this is any help, it is not provided in a standard format. The help for a function should be a single, contiguous block of comments at the top of the function. The help should explain what the arguments are, and what the function does.

If you read through the code, you will find it is liberally sprinkled with global variables, a poor way to teach students to program.

There are some good things to these codes. I found comment lines before each parameter was defined that explain what the variable means. Far better would be if those comments included the units on the variables. For example, I found this in the code:

% Volumetric Flow

What are the units here? Furlongs per fortnight? As such, the comment is almost meaningless, of hardly any help at all.

This author could have written these codes so much more cleanly with little effort. As is, IMHO they lie somewhere between a 1 and a 2 rating. They teach students the wrong things. They teach poor programming habits.

Duane Hanselman

My review has nothing to do with "people with electrical engineering background." My review addresses the quality and usefulness of its MATLAB code only.

Housam Binous

This code should be very useful to people ready to read Example 6.3 in page 144 from the book by O. Levenspiel, Chemical Reaction Engineering, 3rd Edition, Wiley, 1999. Of course, it has no use to people with electrical engineering background such as Duanne Hanselman.

Duane Hanselman

Not a function. Clears the command workspace. No user-settable parameters. No helpful comments. Of use to the author only.


belong to chemical engineering files

MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
Platform Compatibility
Windows macOS Linux