Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Curve fitting data to an extended Antoine equation

Subject: Curve fitting data to an extended Antoine equation

From: Robert

Date: 26 Nov, 2008 22:18:02

Message: 1 of 3

Hi All,

I am running some permeability tests for porous material and I have a set of measure data that I know has a mass flux to pressure relationship that closely follows the vapor pressure model. I am trying to build a tool that will run a curve fit using the data and output the coefficients for an extended Antoine equation. I would like to code it straight in to VBasic so Excel does it automatically, but I could also build a .dll using Matlab and call it in a VBasic subroutine. Excel is the end program I am trying to build this tool in because not everyone uses Matlab. The extended equation form I am using is:

ln(y)=e^(A+B/x+C*ln(x)+D*x+E*x^3)

I have never had to do curve fits like this...Does anyone have an idea on how I could go about doing this?

Thank you!

-Hunter

Subject: Curve fitting data to an extended Antoine equation

From: Miroslav Balda

Date: 27 Nov, 2008 15:51:02

Message: 2 of 3

"Robert " <robert.ashmore@yahoo.com> wrote in message <ggkhuq$1j1$1@fred.mathworks.com>...

SNIP

using the data and output the coefficients for an extended Antoine equation. I would like to code it straight in to VBasic so Excel does it automatically, but I could also build a .dll using Matlab and call it in a VBasic subroutine. Excel is the end program I am trying to build this tool in because not everyone uses Matlab. The extended equation form I am using is:
>
> ln(y)=e^(A+B/x+C*ln(x)+D*x+E*x^3)
 
SNIP

Hi Robert,
The above equation is a simpler form of extended Antoine equation which is more complicated, and has to be solved by a methods for nonlinear optimization using either Optimization Toolbox or some function from FEX, say LMFnlsq.

Fortunately, your form of the equation enables linearization. After aplying natural logarithm on both sides of the equation, we get (for z=log(y))

log(z) = A + B./x + C.*log(x) + D*x + E*x.^3;

It may be solved for unknown vector of linear combination constants A, B, C, D. The solution is

x = x(:);
c = [ones(size(x), 1./x, log(x), x, x.^3] \ log(z(:)) % where

c=[A; B; C; D];

It is necessary to say that the solution minimizes sum of squares of differences of logarthms, not of differences of left and right sides of the original equation. If the later be required, such obtained solution c would be good initial guess for a nonlinear solution.

Hope it helps.

Mira

Subject: Curve fitting data to an extended Antoine equation

From: Glenn

Date: 10 Dec, 2008 18:38:03

Message: 3 of 3

A solution can be found at http://www.matlabprogramming.com/products.htm

"Miroslav Balda" <miroslav.nospam@balda.cz> wrote in message <ggmfl6$5bb$1@fred.mathworks.com>...
> "Robert " <robert.ashmore@yahoo.com> wrote in message <ggkhuq$1j1$1@fred.mathworks.com>...
>
> SNIP
>
> using the data and output the coefficients for an extended Antoine equation. I would like to code it straight in to VBasic so Excel does it automatically, but I could also build a .dll using Matlab and call it in a VBasic subroutine. Excel is the end program I am trying to build this tool in because not everyone uses Matlab. The extended equation form I am using is:
> >
> > ln(y)=e^(A+B/x+C*ln(x)+D*x+E*x^3)
>
> SNIP
>
> Hi Robert,
> The above equation is a simpler form of extended Antoine equation which is more complicated, and has to be solved by a methods for nonlinear optimization using either Optimization Toolbox or some function from FEX, say LMFnlsq.
>
> Fortunately, your form of the equation enables linearization. After aplying natural logarithm on both sides of the equation, we get (for z=log(y))
>
> log(z) = A + B./x + C.*log(x) + D*x + E*x.^3;
>
> It may be solved for unknown vector of linear combination constants A, B, C, D. The solution is
>
> x = x(:);
> c = [ones(size(x), 1./x, log(x), x, x.^3] \ log(z(:)) % where
>
> c=[A; B; C; D];
>
> It is necessary to say that the solution minimizes sum of squares of differences of logarthms, not of differences of left and right sides of the original equation. If the later be required, such obtained solution c would be good initial guess for a nonlinear solution.
>
> Hope it helps.
>
> Mira
>
>

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us