Experimental data fitting from numerical solution of PDE in Matalab
7 views (last 30 days)
Show older comments
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
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().
Accepted Answer
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))
0 Comments
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
end
end
I have left out ALOT of details as there are a lot of examples in the Matlab documentation on these functions.
Good luck.
See Also
Categories
Find more on Boundary Conditions 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!