0% found this document useful (0 votes)
374 views4 pages

Mathcad - Curve Fitting - Regression

This Mathcad document demonstrates different curve fitting regression techniques to fit data including: - Line fitting which results in an equation of y=0.359x + 0.585 with a correlation of 0.967 - Logarithmic fitting with an equation of y=0.343ln(x) + 1.06 having a correlation of 0.914 - Power law fitting producing the equation y=1.718x^0.265 - 0.679 with a correlation of 0.976 - A general function fitting returns the equation y=1.053x - 0.044 and a correlation of 0.967, demonstrating how to define a custom fitting function.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
374 views4 pages

Mathcad - Curve Fitting - Regression

This Mathcad document demonstrates different curve fitting regression techniques to fit data including: - Line fitting which results in an equation of y=0.359x + 0.585 with a correlation of 0.967 - Logarithmic fitting with an equation of y=0.343ln(x) + 1.06 having a correlation of 0.914 - Power law fitting producing the equation y=1.718x^0.265 - 0.679 with a correlation of 0.976 - A general function fitting returns the equation y=1.053x - 0.044 and a correlation of 0.967, demonstrating how to define a custom fitting function.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Mathcad Tutorial on Curve Fitting - Regression

N 20
i 0 N
f ( x)

x 0.1

vxi i x
vyi f vxi

vy
0.5

0.5

1.5

vx

Generate random numbers in order to simulate measurement errors

vy [ vy ( 1 rnorm ( N 1 0 0.1) ) ] vx [ vx ( 1 rnorm ( N 1 0 0.05) ) ]


vy0 rnorm ( 1 0 0.05) 0

vx0 rnorm ( 1 0 0.025) 0

vy
0.5

0.5

1.5

vx

Middle East Technical University, METU, Ankara/TURKEY


1

Dr. Ender CEROLU

Mathcad Tutorial on Curve Fitting - Regression

Line Fit

a
line ( vx vy)
b

a 0.359

b 0.585

g ( x) a b x

1.5

vy
g ( x)

0.5

0.5

1.5

vx x

corr f ( vx) vy 0.967

Calculates the correlation between actual data and


curve fitted data. For perfect fit it is 1.0.

Logarithmic Fit

a
lnfit ( vx vy)
b

a 0.343

b 1.06

h ( x) a ln ( x) b

1.5

vy
g ( x)

h ( x)

corr g ( vx) vy 0.914

0.5

0.5

1.5

vx x

0.5
b logfit vx vy 0.2

0.6

a 0.504
b 0.116
c 0.994

Middle East Technical University, METU, Ankara/TURKEY


2

j ( x) a ln ( x b) c

Dr. Ender CEROLU

Mathcad Tutorial on Curve Fitting - Regression

1.5

vy
g ( x)
h ( x)

j ( x)

corr j ( vx) vy 0.978

0.5

0.5

1.5

vx x

Power Fit

0.5

b pwrfit vx vy 0.2

0.6

vy

a 1.718
b 0.265
c 0.679

k ( x) a x c

1.5

g ( x)
h ( x)

j ( x)
k ( x)

corr k ( vx) vy 0.976

0.5

0.5

1.5

vx x

General Function Fit


F ( x a b) a x b Create a general function that you would like to fit the dat

0.5
genfit vx vy F

0.1
b

a 1.053

b 0.044

Middle East Technical University, METU, Ankara/TURKEY


3

l ( x) a x b

Dr. Ender CEROLU

Mathcad Tutorial on Curve Fitting - Regression

vy
h ( x)

j ( x)

l ( x) 0.5

corr l ( vx) vy 0.967

k ( x)

0.5

1.5

vx x

Middle East Technical University, METU, Ankara/TURKEY


4

Dr. Ender CEROLU

You might also like