Вы находитесь на странице: 1из 6

Units, functions, etc

Data
0 1 2 3
0 0.375 0.25 0.859 1.011
1 0.375 0.25 0.935 1.124
2 0.25 0.5 0.888 ...

0 1 2 3
X Data 100 Y Data 100 Z1 Data Z2 Data

( X YZ1)

Polynomial surface fit

0 0 1 0
XY X XY Y

Polynomial degree: Degree 2

coeffs1 regress( XY Z1 Degree )


Get rid of the initiaal tersm that are only needed by interp

0
coeffs1 submatrix coeffs1 3 last coeffs1 0 0
T
coeffs1 2.613 10
5
7.5108 10
5
0.0074 0.7396 0.0026 0.0001
Functions for coefficient order

( 2 deg)
Nterms( deg)
deg 2

Step( v Nvar deg) for i 0 deg if Nvar = 1


v v i
i 0 i 0
for i 0 Nvar 1 if deg = 1
v v 1
i i i i

otherwise
inc Nterms( deg 1 )
for i 0 inc 1
v v 1
i Nvar 1 i Nvar 1
v stack( Step( submatrix( v 0 inc 1 0 cols( v ) 1 ) Nvar deg 1 ) Step( sub
v

COrder( deg) v 0
Nterms( deg) 1 1
Step( v 2 deg)
Functions for coefficient order

The number of terms: Nterms( Degree ) 6

The powers of x and y. The first column is the power of x, the second column the power of y

1 1
0 2

0 1
I COrder( Degree ) I
0 0
1 0


2 0

This is then the expression for the multidimensional polynomial






last ( Coeffs)
I I
Coeffs X Y 1

i 0 i
Fit( X Y Coeffs I)
i
i 0
Fit1( x y ) Fit( x y coeffs1 I)

Create a fitted surface using the CreateMesh function

For viewing, extrapolate surface by: E 3

x s min( X) E x e max( X) E y s min( Y) E y e max( Y) E


F1 CreateMesh Fit1 x s x e y s y e 10 10

( X Y Z1 ) F1
This data has a lot of scatter!

( X Y Z2 )

coeffs2 regress( XY Z2 Degree )


0
coeffs2 submatrix coeffs2 3 last coeffs2 0 0
T
coeffs2 4.1329 10
5
3.6324 10
5
0.0014 0.9215 0.0195 0.0004

bmatrix( v inc rows( v ) 1 0 cols( v ) 1 ) Nvar 1 deg))


Fit2( x y ) Fit( x y coeffs2 I)


F2 CreateMesh Fit2 x s x e y s y e 10 10

( X Y Z2 ) F2

Вам также может понравиться