Curve fitting to diffusion equation(Matlab)

  • Thread starter msumani
  • Start date
  • #1
1
0
We have been trying to fit experimental diffusion results to the diffusion equation using Matlab to evaluate the Diffusion coefficient.
The equation we used:
y=C*erfc(x/(2*sqrt(D*t)))
Experimental values [x],[y] and t are given. C and D are to be evaluated from the curve fit.
We used cftool of Matlab.
We have a problem in getting the results. We get error message as:

"Error using ==> <a href="error:C:\Program Files\MATLAB\R2007b\toolbox\curvefit\curvefit\@fittype\feval.m,97,0">fittype.feval at 97</a>
Error in fittype expression ==> C.*erfc(x./(2.*sqrt(D.*300)))
??? Error using ==> erfcore
Input must be real."

Can anyone help?
 

Answers and Replies

  • #2
207
30
It looks like the problem is that the error function requires real input arguments. Looking at your expression I would say the most likely problem is that the D parameter gets negative during the fitting, and as such maybe you could try to use abs(D) instead, although this could lead to the fitting algorithm having problems finding the right values.
 

Related Threads on Curve fitting to diffusion equation(Matlab)

  • Last Post
Replies
7
Views
862
  • Last Post
Replies
0
Views
3K
  • Last Post
Replies
2
Views
1K
Replies
4
Views
8K
  • Last Post
Replies
9
Views
1K
  • Last Post
Replies
0
Views
1K
Replies
18
Views
3K
Replies
1
Views
2K
Replies
2
Views
837
  • Last Post
Replies
0
Views
2K
Top