MATLAB Answers

Experimental data fitting from numerical solution of PDE in Matalab

12 views (last 30 days)
Jung on 16 Dec 2011
Hello, I have tried to fit the experimental data by PDE equation. Can you teach me how to do it?
My parabolic PDE equations is dq/dt=(1/r^2)*d(D*(1/r^2)*(dq/dr)).
I.C. q(r,0)=0
B.C. dq(0,t)/dr=0
B.C. dq/dt=kl*(c-cs) at r=R, c=cs
I searched previous questions (optimaization toolbox-->lsqcurvefit). But, I need to have more detailed procedure.
Thank you for your help in advance.

  1 Comment

Sean de Wolski
Sean de Wolski on 16 Dec 2011
Can you please format your code and include the code you've tried, i.e. your setup and call to lsqcurvefit().

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 16 Dec 2011
In the subexpression d(D*(1/r^2)*(dq/dr)) is D a constant? Does the leading "d" indicate differentiation? If so, then with respect to which variable?
Does dq(0,t)/dr indicate dq/dr evaluated at (0,t) ?
You show the condition c=cs in your second boundary condition, but you had not mentioned c before. Is c a function of r and t ? Why mention the "r=R" if r is not involved in kl*(c-cs) ? At c=cs then (c-cs) would seem to be 0, and since no matter what finite value kl is, kl*0 is going to be 0, you seem to be indicating that dq/dt will be 0 whenever c=cs -- was that your intention ?
Some of the combinations I tried only have q(r,t) = 0 as a solution, and the other combinations didn't resolve. I will need to see your clarifications to go further.
Note to myself:
pdsolve([diff(q(r, t), t) = (diff(D1*(diff(q(r, t), r))/r^2, t))/r^2, q(r, 0) = 0, (D[1](q))(0, t) = 0], q(r, t))


Sign in to comment.

More Answers (2)

Marc on 21 Dec 2011
This problem has been looked at in great detail by many. I recommend a group at Rutgers, led by Prof. Glasser. Their work looks at metal adsorption within oxide pellets and spheres.
Their research focuses on metal profiles after drying but their adsorption model is very complete. Plus the references they cite lead to more simplified approaches.
My recommendation is to transform the system of PDEs into ODEs using a finite difference approach in the spatial domain. Leaving a system of ODEs ( or DAE) easily solved in Matlab by ode15s.
You can then set up a function within your function something like this for nlinfit or lscurvefit....
function [t,y]=yourfunc(a,b,c)
tspan = [to tf];
[t,y] = ode15s(@odefunc,tspan,yo);
function dydt = odefunc(t,y)
dydt = zeros(some_value, 1); dydt(1) = a*.... your equations with parameters a,b and c you want to fit
I have left out ALOT of details as there are a lot of examples in the Matlab documentation on these functions.
Good luck.

Jung on 18 Dec 2011
Hi Walter and Sean, thank you for your comments and teaching. I think I need to define the equations clearly to ask more. The equation is supposed to describe the concentration of profile of adsorbate inside a spherical particle. q: amount of adsorption q is the function of time and radius (function q=q(r,t)) r: radius of particle (r is from 0 to R) d: differentiation D: diffusivity of adsorbate c: concentration of adsorbate (c is from c0 (at t=0) to c(at t=time at equilibrium) k: liquid film transport coefficient cs: concentration of adsorbate at particle surface (r=R)
dq/dr=(1/r^2)*d(D*(dq/dr))is equal to dc/dr=(1/r^2))*d(D*(dc/dr). Initial condition: c=q=0 at t=0 Boundary condition: dc/dr=dq/dr=0 at the center of a particle at any time Another boundary condition: -dc/dt=k*(c-cs) at r=R at anytime
I have experimental data (c VS t) so that I have tried to fit the data to above equation to estimate diffusivity and check the validation of this euqation. I am a beginner in matlab so that I don't have matlab code right now. could you teach me how to fit the data using above equation. Thank you for your help.


Sign in to comment.

Community Treasure Hunt

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

Start Hunting!