Curve fitting to diffusion equation(Matlab)

Another option would be to use a different error function that is better suited for your data. In summary, the conversation is about trying to fit experimental diffusion results to the diffusion equation using Matlab. They encountered a problem with getting results and received an error message regarding the use of the error function. They discuss possible solutions such as using abs(D) or using a different error function.
  • #1
msumani
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?
 
Physics news on Phys.org
  • #2
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.
 

1. What is curve fitting?

Curve fitting is the process of finding a mathematical function that best represents a set of data points. In the context of diffusion equations, curve fitting is used to determine the diffusion coefficient and other parameters that describe the behavior of a substance as it diffuses through a medium.

2. Why is curve fitting important in analyzing diffusion equations?

Curve fitting allows us to extract important information about the behavior of a substance as it diffuses through a medium. This information can help us understand the underlying processes and make predictions about future behavior.

3. How does Matlab perform curve fitting to diffusion equations?

Matlab has various built-in functions and tools that allow for curve fitting to diffusion equations. These include the fit function, which can fit a variety of curve types to data, and the ode45 function, which can solve differential equations such as the diffusion equation.

4. What factors should be considered when choosing a curve fitting method for diffusion equations?

When choosing a curve fitting method for diffusion equations, it is important to consider the type of data being analyzed, the level of uncertainty in the data, and the desired accuracy of the results. Different methods may be more suitable for different types of data or levels of uncertainty.

5. Are there any limitations to curve fitting in analyzing diffusion equations?

Yes, there are some limitations to curve fitting in analyzing diffusion equations. The accuracy of the results can be affected by the quality and quantity of the data, as well as the assumptions made in the curve fitting process. It is also important to note that curve fitting is a mathematical approximation and may not perfectly represent the behavior of a substance as it diffuses through a medium.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
984
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
2
Replies
41
Views
8K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
Back
Top