matlab - Latest Commentshttp://matlab-cheme-cmu.disqus.com/enSat, 29 Apr 2017 16:14:41 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2011/10/21/linear-programming-example-with-inequality-constraints/#comment-3280867246<p>what does [] [] mean and do we use it pls?</p>charlesSat, 29 Apr 2017 16:14:41 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2011/09/02/stopping-the-integration-of-an-ode-at-some-condition/#comment-3210663239<p>thanks, that's really helpful!</p>Christopher CrawfordSat, 18 Mar 2017 13:20:17 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2012/08/27/peak-finding-in-raman-spectroscopy/#comment-3210099248<p>I am facing problem in using command "textread".</p>Muhammad Aqeel AslamSat, 18 Mar 2017 02:25:19 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2011/11/21/interacting-with-the-steam-entropy-temperature-chart/#comment-3207763370<p>I am glad it is helpful to you!</p>JohnKitchinThu, 16 Mar 2017 16:02:18 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2011/11/21/interacting-with-the-steam-entropy-temperature-chart/#comment-3207550121<p>Thanks allot for this code. It came of great use when writing a report on a geothermal power cycle.</p>Friðrik HoverThu, 16 Mar 2017 13:56:41 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2011/11/21/interacting-with-the-steam-entropy-temperature-chart/#comment-3207544133<p>The fact is when you download for example XSteam.m directly it gives you a much smaller .m file than if you download it from the Download Submission button (or download zip as it's named now). You also get a pdf manual for the program in the zip folder.<br>BTW. Thank you John Kitchin for this code, I love it.</p>Friðrik HoverThu, 16 Mar 2017 13:53:12 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2011/09/02/stopping-the-integration-of-an-ode-at-some-condition/#comment-3096879855<p>Can 'value' be a vector..??</p>batmanFri, 13 Jan 2017 00:27:23 -0000Re: Matlab in Chemical Engineering at CMU http://matlab.cheme.cmu.edu/2011/12/25/finding-equilibrium-composition-by-direct-minimization-of-gibbs-free-energy-on-mole-numbers/#comment-3040319036<p>I had trouble running matlab with your function code, i had to change nj in x! Anyway,just one question: the Gjo are calculated at 1000K?</p>DareToKnowWed, 07 Dec 2016 07:51:08 -0000Re: Matlab in Chemical Engineering at CMU http://matlab.cheme.cmu.edu/2011/12/25/finding-equilibrium-composition-by-direct-minimization-of-gibbs-free-energy-on-mole-numbers/#comment-3011426361<p>I don't have anything like that.</p>JohnKitchinSun, 20 Nov 2016 09:48:01 -0000Re: Matlab in Chemical Engineering at CMU http://matlab.cheme.cmu.edu/2011/12/25/finding-equilibrium-composition-by-direct-minimization-of-gibbs-free-energy-on-mole-numbers/#comment-3011009953<p>Hi John!</p><p>I really am glad I came across your page. I'm curious, do you have a basic skeleton for a minimization of Gibbs Free Energy with a binary phase diagram by any chance? I'm a novice at this and I'm interested in getting started looking at phase diagrams with MATLAB. Your help would be greatly appreciated!</p>MJESun, 20 Nov 2016 01:31:53 -0000Re: Matlab in Chemical Engineering at CMU http://matlab.cheme.cmu.edu/2011/12/25/finding-equilibrium-composition-by-direct-minimization-of-gibbs-free-energy-on-mole-numbers/#comment-3008358125<p>I am not sure what you mean by not running properly. The post is published directly from Matlab. Do you think the answer is incorrect?</p>JohnKitchinFri, 18 Nov 2016 09:12:47 -0000Re: Matlab in Chemical Engineering at CMU http://matlab.cheme.cmu.edu/2011/12/25/finding-equilibrium-composition-by-direct-minimization-of-gibbs-free-energy-on-mole-numbers/#comment-3008194186<p>Hi John! <br>Very useful program, thank you! One thing i'd like to point out, there's a mistake in the function (it has to be used x and not nj,otherwise the code can't run properly).<br>I would like to ask if there's a possibility of having the matlab code using S A algorithm (if exists a chance of using this kind of method)! I'm trying on my own but I'm facing multiple troubles due to my basic knowledge of Matlab.<br>Thanks in advance!</p>DareToKnowFri, 18 Nov 2016 06:38:06 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2011/09/29/fitting-a-numerical-ode-solution-to-data/#comment-2922895538<p>Hello,</p><p>i try to do parameterisation of the system of differential equations (nested function). I keep getting an Error message:<br> >> cost_menstrual<br>Not enough input arguments.</p><p>Can anyone help me, i'm new to matlab.</p><p>Error in cost_menstrual (line 14)<br> times, h0, vopt, params);<br>my 2 functions are as follow:</p><p>global times<br>global measurements</p><p>function ydot=ode_menstrual_parametric(t,y,p)<br>y0=[ 29.6472 6.8618 8.4669 6.1458 3.8327 11.5057 5.4786 19.2717 45.6416 100.7348 125.9500 135.8355 168.7130];</p><p>% Initializing parameter vector<br>p(1)=v_0LH;<br>p(2)=v_1LH;<br>p(3)=Km_LH;<br>p(4)=Ki_LHP;<br>p(5)=k_LH;<br>p(6)=c_LHP;<br>p(7)=c_LHE;<br>p(8)=d_E;<br>p(9)=d_P;<br>p(10)=v_FSH;<br>p(11)=Ki_FSHIh;<br>p(12)=k_FSH;<br>p(13)=c_FSHP;<br>p(14)=c_FSHE;<br>p(15)=d_Ih;<br>p(16)=alpha;<br>p(17)=beta;<br>p(18)=gamma;<br>p(19)=b;<br>p(20)=c_1;<br>p(21)=c_2;<br>p(22)=c_3;<br>p(23)=c_4;<br>p(24)=c_5;<br>p(25)=d_1;<br>p(26)=d_2;<br>p(27)=k_1;<br>p(28)=k_2;<br>p(29)=k_3;<br>p(30)=k_4;<br>p(31)=e_0;<br>p(32)=e_1;<br>p(33)=e_2;<br>p(34)=e_3;<br>p(35)=p_0;<br>p(36)=p_1;<br>p(37)=p_2;<br>p(38)=h_0;<br>p(39)=h_1;<br>p(40)=h_2;<br>p(41)=h_3;</p><p>ydot=[y(1); y(2); y(3); y(4); y(5); y(6); y(7); y(8); y(9); y(10); y(11); y(12); y(13)];<br>% Auxiliary equations<br>E_2=e_0+e_1*y(6)+e_2*y(7)+e_3*y(13);<br>P_4=p_0+p_1*y(12)+p_2*y(13);<br>Ih=h_0+h_1*y(7)+h_2*y(11)+h_3*y(12);</p><p>% System of Differential Equations:</p><p>dydt(1)=(v_0LH+v_1LH*(E2_lag/Km_LH)^a/(1+(E2_lag/Km_LH)^a))/(1+P4_lag/Ki_LHP)-k_LH*((1+c_LHP*P_4)/(1+c_LHE*E_2))*y(1);<br>dydt(2)=(1/vol)*k_LH*((1+c_LHP*P_4)/(1+c_LHE*E_2))*y(1)-a_LH*y(2);<br>dydt(3)=v_FSH/(1+Ih_lag/Ki_FSHIh)-k_FSH*((1+c_FSHP*P_4)/(1+c_FSHE*E_2^2))*y(3);<br>dydt(4)=(1/vol)*k_FSH*((1+c_FSHP*P_4)/(1+c_FSHE*E_2^2))*y(3)-a_FSH*y(4);<br>dydt(5)=b*y(4)+(c_1*y(4)-c_2*y(2)^alpha)*y(5);<br>dydt(6)=c_2*(y(2)^alpha)*y(5)+(c_3*(y(2)^beta)-c_4*y(2))*y(6);<br>dydt(7)=c_4*y(2)*y(6)-c_5*y(2)^gamma*y(7);<br>dydt(8)=c_5*y(2)^gamma*y(7)-d_1*y(8);<br>dydt(9)=d_1*y(8)-d_2*y(9);<br>dydt(10)=d_2*y(9)-k_1*y(10);<br>dydt(11)=k_1*y(10)-k_2*y(11);<br>dydt(12)=k_2*y(11)-k_3*y(12);<br>dydt(13)=k_3*y(12)-k_4*y(13);<br>ydot=[y(1);y(2);y(3);y(4);y(5);y(6);y(7);y(8);y(9);y(10);y(11);y(12);y(13)];</p><p>function cost=cost_menstrual(params)<br>global times;<br>global measurements;</p><p>h0=[ 29.6472 6.8618 8.4669 6.1458 3.8327 11.5057 5.4786 19.2717 45.6416 100.7348 125.9500 135.8355 168.7130];<br>vopt=odeset('InitialStep',0.04,'MaxStep',0.04);<br>%% Initial conditions <br>%y0=[ 29.6472 6.8618 8.4669 6.1458 3.8327 11.5057 5.4786 19.2717 45.6416 100.7348 125.9500 135.8355 168.7130];</p><p>%IC=[RP_LH_zero,LH_zero,RP_FSH_zero,FSH_zero,MsF_zero,SeF_zero,PrF_zero,Sc1_zero,Sc2_zero,Lut1_zero,Lut2_zero,Lut3_zero,Lut4_zero];</p><p>[t,h]=ode45(@ode_menstrual_parametric,...<br> times, h0, vopt, params);</p><p>%residual sum of squares<br>costs=sum((h-measurements).^2);<br>cost=sum(costs);</p>Malgorzata WieteskaWed, 28 Sep 2016 09:34:27 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2012/08/31/what_do_you_want-m/#comment-2840841959<p>First hit on google: matlab excel ;)</p><p><a href="http://www.mathworks.com/help/matlab/ref/xlsread.html" rel="nofollow noopener">http://www.mathworks.com/he...</a></p>JohnKitchinTue, 16 Aug 2016 15:19:29 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2012/08/31/what_do_you_want-m/#comment-2840578658<p>Dear Sir,</p><p>I would like plot DLS data using MATLAB, my excell sheet comprises of 14 tables filled. I have been using Origin 8 to plot. Please suggest how to use MATLAB to import this file and also plot gaussian curve fit for these data points.</p><p>Thank you,</p>KrishnarkaTue, 16 Aug 2016 13:00:19 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2011/12/12/water-gas-shift-equilibria-via-the-nist-webbook/#comment-2790209457<p>To calculate Gjo I used the same method as the first example you posted (H-TS). Unfortunately, however, the values are all different. I also simulated with AspenPlus and results are equal to yours. it's very strange, the matlab-script is correct but I don't understand how you find the G° data. Thank you very much for your answer and for your help :)</p>Andrea CardisMon, 18 Jul 2016 17:49:20 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2011/12/12/water-gas-shift-equilibria-via-the-nist-webbook/#comment-2789960729<p>All I can say is it must have worked once. I am not using matlab anymore so it is hard to tell why yours doesn't work. </p>JohnKitchinMon, 18 Jul 2016 15:28:06 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2011/12/12/water-gas-shift-equilibria-via-the-nist-webbook/#comment-2789782157<p>Sorry, I don't understand how you find the "Gjo" array in the second problem, my values are totally different. Can you help me?</p>Andrea CardisMon, 18 Jul 2016 13:54:37 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2011/09/02/stopping-the-integration-of-an-ode-at-some-condition/#comment-2780424927<p>It was very helpful in understanding use of event function. :)</p>hush hsuhWed, 13 Jul 2016 04:53:09 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2011/11/17/modeling-a-transient-plug-flow-reactor/#comment-2718341428<p>it doesn't work :( please help me. send me complete m.file to rezhapachlevi@gmail.com</p>Mochammad Rezha PachleviWed, 08 Jun 2016 04:57:49 -0000Re: Matlab in Chemical Engineering at CMU http://matlab.cheme.cmu.edu/2011/12/25/finding-equilibrium-composition-by-direct-minimization-of-gibbs-free-energy-on-mole-numbers/#comment-2645693689<p>usually it is given, or looked up in tables. You could also use the NIST webbook, eg <a href="http://matlab.cheme.cmu.edu/2011/12/12/water-gas-shift-equilibria-via-the-nist-webbook/" rel="nofollow noopener">http://matlab.cheme.cmu.edu...</a>.</p>JohnKitchinWed, 27 Apr 2016 12:39:25 -0000Re: Matlab in Chemical Engineering at CMU http://matlab.cheme.cmu.edu/2011/12/25/finding-equilibrium-composition-by-direct-minimization-of-gibbs-free-energy-on-mole-numbers/#comment-2645523512<p>Gjo = [4.61 28.249 40.604 -94.61 -47.942 0 0 -46.03 26.13]; % kcal/mol</p><p>How can I get these values ?</p>Mohamed ElganzoryWed, 27 Apr 2016 11:02:43 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2011/10/30/smooth-transitions-between-discontinuous-functions/#comment-2636149416<p>This website uses tanh to smoothly transition between a pair of functions: <br><a href="http://www.j-raedler.de/2010/10/smooth-transition-between-functions-with-tanh/" rel="nofollow noopener">http://www.j-raedler.de/201...</a></p>Stuart RogersThu, 21 Apr 2016 17:22:38 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2011/11/18/numerically-calculating-an-effectiveness-factor-for-a-porous-catalyst-bead/#comment-2584857077<p>Thanks for the suggestion!</p>JohnKitchinWed, 23 Mar 2016 09:19:32 -0000Re:
Matlab in Chemical Engineering at CMU
http://matlab.cheme.cmu.edu/2011/11/18/numerically-calculating-an-effectiveness-factor-for-a-porous-catalyst-bead/#comment-2584549929<p>First, I want to thank you for this explanaition. It has helped me a lot in some work I am doing. However, I would like to suggest the addition of a short piece of coding to automatically guess the value of Ca0 in a iterative process. I have written it considering the bisection method, here is the code</p><p>------------------------<br>%% Definition of Ca0 values for calculation</p><p>% Minimum, maximum and the initial Ca0 to start iterations are assigned</p><p> Ca0min = 0; % concentrion could be 0 in the center of the particle, but not negative</p><p> Ca0max = CAs; % concentrion could be the same as concentration on the outter surface of the catalyts</p><p> Ca0 = mean([Ca0min CAs]); % initial guess is mean between Camin and Camax</p><p>%% Boundary condition</p><p> Wa0 = 0; % no flux at r=0 (mol/m^2/s)</p><p> % the other boundary condition, Ca(R) = CAs, is checked in the while</p><p> % loop that is presented below.</p><p>%% Definition of range to perform the integration of the diff ecuation</p><p> rspan = [0 R];</p><p>%% Calculation of Ca0</p><p> Ca = Ca0; % this value is initially assign to be able to enter in the while loop</p><p> while abs(Ca(end)-CAs) >= 0.001</p><p> init = [Wa0 Ca0];</p><p> [r, Y] = ode45(@ode,rspan, init);</p><p> Ca = Y(:,2);</p><p> % check bisection method</p><p> if abs(Ca(end)-CAs) < 0.001</p><p> continue</p><p> elseif Ca(end) > CAs</p><p> Ca0max = Ca0;</p><p> Ca0 = mean([Ca0min Ca0max]);</p><p> else</p><p> Ca0min = Ca0;</p><p> Ca0 = mean([Ca0min Ca0max]);</p><p>end</p><p> end<br>------------------------------</p><p>Best regards and thanks again!</p><p>Carlos</p>Carlos OrtegaWed, 23 Mar 2016 03:26:26 -0000