Problem with combining vectors in a formula and finding intersections of graphs

1 view (last 30 days)
As a second year Chemistry student I have to design a distallation column to seperate two chemicals. I have already programmed a large part of the column, but for now I'm stuck at some things I don't know how to program (even after researching on Google).
Let me explain my script: In my script I want to calculate at which temperature the distillation process will be the cheapest and therefore I use a for-loop over a range of temperatures (for(T = 298:550). First the alpha (the relative volatility) will be calculated and stored in alphavect[]. When the alpha is obtained, a some graphs will be calculated by a for-loop over x from 0 to 1. The most important one is the equilibrium line, yeq (to make it easier to find I put an % before the formula in question), and that is the one I'm struggling with. After the x-loop, which will be repeated for every T, Matlab continues the results in the same row. So I get a 1x25000 vector in yeqvect instead of an 250x100 matrix. This is the first problem I can't solve.
The next problem is a bit further in the script: after yeq and yf (the feedline) are calculated and stored in seperated vectors I need to find the x and y position of the intersection of those two. I tried to do this in a very dumb way: just wait until both are equal and then store the x as xinf (x infinite, the position of the intersection). Matlab gives an error for this, but this will also not work because the yf and yeq have too many decimals to be equal at a change of x of 0.01 at every loop. Is there a smarter way to do this? The part regarding the second question is commented with %%, so it will be easier to find.
For the experienced matlab users this will probably be very easy questions, but I just started using Matlab and would like to learn it. I have asked the teacher how to do it, but she refuses to answer so I hope someone can help me.
With kind regards, Jeroen

Answers (0)

Categories

Find more on Chemistry in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!