0 Up votes0 Down votes

24 views10 pagesj

Aug 05, 2016

© © All Rights Reserved

PDF, TXT or read online from Scribd

j

© All Rights Reserved

24 views

j

© All Rights Reserved

- sury
- Math10 Tg u2
- Interpolate Values Using the FORECAST Function - Excel Off the Grid
- MIMO_MPC
- Math 1B Berkeley Spring 2012
- Solving Polynomial Inequalities by Graphing
- Chapter 2
- Introduction to Groups, In Variants, And Particles - F. Firk
- 05640694
- Radar Data - 2012 Lakshmanan
- George Francis, John M. Sullivan and Chris Hartman- Computing Sphere Eversions
- D3D Driving Cars Instructions
- Indecomposability of polynomials and related Diophantine equations.pdf
- Ec1 Uk Annex
- Untitled
- Control System Using MATLAB (12.10.2012)
- Ayman Review Ch_02
- Graphical Representation of Data
- Several Variables Orthogonal
- 00968600

You are on page 1of 10

example

Load some data, fit a quadratic curve to variables cdate and pop, and plot the fit and data.

load census;

f=fit(cdate,pop,'poly2')

plot(f,cdate,pop)

f =

Linear model Poly2:

f(x) = p1*x^2 + p2*x + p3

Coefficients (with 95% confidence bounds):

p1 =

0.006541 (0.006124, 0.006958)

p2 =

-23.51 (-25.09, -21.93)

p3 =

2.113e+04 (1.964e+04, 2.262e+04)

fitobject = fit([x,y],z,fitType)

example

Load some data and fit a polynomial surface of degree 2 in x and degree 3 in y. Plot the fit and data.

load franke

sf = fit([x, y],z,'poly23')

plot(sf,[x,y],z)

Linear model Poly23:

sf(x,y) = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 + p21*x^2*y

+ p12*x*y^2 + p03*y^3

Coefficients (with 95% confidence bounds):

p00 =

1.118 (0.9149, 1.321)

p10 = -0.0002941 (-0.000502, -8.623e-05)

p01 =

1.533 (0.7032, 2.364)

p20 = -1.966e-08 (-7.084e-08, 3.152e-08)

p11 =

0.0003427 (-0.0001009, 0.0007863)

p02 =

-6.951 (-8.421, -5.481)

p21 =

9.563e-08 (6.276e-09, 1.85e-07)

p12 = -0.0004401 (-0.0007082, -0.0001721)

p03 =

4.999 (4.082, 5.917)

fitobject = fit(x,y,fitType,fitOptions)

example

Load and plot the data, create fit options and fit type using the fittype and fitoptions functions, then

create and plot the fit.

Load and plot the data in census.mat.

load census

plot(cdate,pop,'o')

Create a fit options object and a fit type for the custom nonlinear model

coefficients and n is a problem-dependent parameter.

fo = fitoptions('Method','NonlinearLeastSquares',...

'Lower',[0,0],...

'Upper',[Inf,max(cdate)],...

'StartPoint',[1 1]);

ft = fittype('a*(x-b)^n','problem','n','options',fo);

Fit the data using the fit options and a value of n = 2.

[curve2,gof2] = fit(cdate,pop,ft,'problem',2)

curve2 =

General model:

curve2(x) = a*(x-b)^n

Coefficients (with 95% confidence bounds):

a =

0.006092 (0.005743, 0.006441)

b =

1789 (1784, 1793)

Problem parameters:

n =

2

gof2 =

sse: 246.1543

rsquare:

dfe:

adjrsquare:

rmse:

0.9980

19

0.9979

3.5994

[curve3,gof3] = fit(cdate,pop,ft,'problem',3)

curve3 =

General model:

curve3(x) = a*(x-b)^n

Coefficients (with 95% confidence bounds):

a =

1.359e-05 (1.245e-05, 1.474e-05)

b =

1725 (1718, 1731)

Problem parameters:

n =

3

gof3 =

sse:

rsquare:

dfe:

adjrsquare:

rmse:

232.0058

0.9981

19

0.9980

3.4944

hold on

plot(curve2,'m')

plot(curve3,'c')

legend('Data','n=2','n=3')

hold off

fitobject = fit(x,y,fitType,Name,Value)

example

[fitobject,gof] = fit(x,y,fitType)

example

[fitobject,gof,output] = fit(x,y,fitType)

The following tables describe the library model types for curves and surfaces.

Use the links in the table for examples and detailed information on each library type.

If you want a quick reference of model names for input arguments to the fit function, see Model Names and

Equations.

Library Model Types for

Curves

Description

distribution

exponential

See Exponential Models.

fourier

Curves

Description

gaussian

interpolant

shape-preserving cubic spline. SeeNonparametric Fitting.

polynomial

power

Power function and sum of two power functions. See Power Series.

rational

in both the numerator and the denominator). See Rational Polynomials.

sin

spline

Surfaces

Description

interpolant

biharmonic, and thin-plate spline interpolation. See Interpolants.

lowess

polynomial

To specify the model you want to fit, consult the following tables for a model name to use as an input argument

to the fit function. For example, to specify a quadratic curve with model name "poly2" :

f = fit(x, y,

'poly2')

Examples of Polynomial Model Names for Curves

Equations

poly1

Y = p1*x+p2

poly2

Y = p1*x^2+p2*x+p3

poly3

Y = p1*x^3+p2*x^2+...+p4

...etc., up to poly9

Y = p1*x^9+p2*x^8+...+p10

For polynomial surfaces, model names are 'polyij', where i is the degree in x and j is the degree in y. The

maximum for both i and j is five. The degree of the polynomial is the maximum of i and j. The degree of x in

each term will be less than or equal to i, and the degree of y in each term will be less than or equal to j. See

the following table for some example model names and equations, of many potential examples.

Names for Surfaces

Equations

poly21

p11*x*y

poly13

p02*y^2 + p12*x*y^2 + p03*y^3

poly55

p05*y^5

Distribution Model Names

Equations

weibull

Y = a*b*x^(b-1)*exp(-a*x^b)

Exponential Model Names

Equations

exp1

Y = a*exp(b*x)

exp2

Y = a*exp(b*x)+c*exp(d*x)

Fourier Series Model

Names

Equations

fourier1

Y = a0+a1*cos(x*p)+b1*sin(x*p)

fourier2

Y = a0+a1*cos(x*p)+b1*sin(x*p)...

+a2*cos(2*x*p)+b2*sin(2*x*p)

fourier3

Y = a0+a1*cos(x*p)+b1*sin(x*p)...

+a3*cos(3*x*p)+b3*sin(3*x*p)

...etc., up

to fourier8

Y = a0+a1*cos(x*p)+b1*sin(x*p)...

+a8*cos(8*x*p)+b8*sin(8*x*p)

Where p = 2*pi/(max(xdata)-min(xdata)).

Gaussian Model Names and Equations

Gaussian Model

Names

Equations

Gaussian Model

Names

Equations

gauss1

Y = a1*exp(-((x-b1)/c1)^2)

gauss2

Y = a1*exp(-((x-b1)/c1)^2)+a2*... exp(-((xb2)/c2)^2)

gauss3

Y = a1*exp(-((x-b1)/c1)^2)+... +a3*exp(-((xb3)/c3)^2)

...etc., up

to gauss8

Power Model Names

Equations

power1

Y = a*x^b

power2

Y = a*x^b+c

Rational models are polynomials over polynomials with the leading coefficient of the denominator set to 1.

Model names are ratij, where i is the degree of the numerator and j is the degree of the denominator. The

degrees go up to five for both the numerator and the denominator.

Examples of Rational Model Names

Equations

rat02

Y = (p1)/(x^2+q1*x+q2)

rat21

Y = (p1*x^2+p2*x+p3)/(x+q1)

rat55

Y = (p1*x^5+...+p6)/(x^5+...+q5)

Sum of Sine Model Names

Equations

sin1

Y = a1*sin(b1*x+c1)

sin2

Y = a1*sin(b1*x+c1)+a2*sin... (b2*x+c2)

sin3

Y = a1*sin(b1*x+c1)+... +a3*sin(b3*x+c3)

Equations

...etc., up to sin8

Y = a1*sin(b1*x+c1)+... +a8*sin(b8*x+c8)

Spline models are supported for curve fitting, not for surface fitting.

Spline Model Names

Description

cubicspline

smoothingspline

Smoothing spline

Interpolant Model

Names

Description

linearinterp

Linear interpolation

nearestinterp

cubicinterp

Curves only

pchipinterp

(pchip) interpolation

Surfaces only

biharmonicinterp

thinplateinterp

Type

Curves and

Surfaces

Lowess models are supported for surface fitting, not for curve fitting.

Lowess Model Names

Description

lowess

loess

Fit

Fit model or boundary model to new or existing data, and provide summary statistics

Syntax

[statistics, model] = Fit(model, X, Y)

[statistics, model] = Fit(model)

B = mbcboundary.Fit(X,Type)

Description

This is a method of mbcmodel.model and mbcboundary.Model.

[statistics, model] = Fit(model, X, Y) This fits the model to the specified data. After you have

called Fit specifying the data to use, then you can refit the model by calling[statistics, model]

= Fit(model).

The response object that the model came from defines which summary statistics are returned. To see these

statistics, call SummaryStatistics. These statistics appear in the Summary Statistics pane of the Model

Browser GUI. The statistics returned depend on the model type.

For a linear model, the statistics are:

'Observations','Parameters','Box-Cox','PRESS RMSE','RMSE'.

For a neural network model:

'Observations','Parameters', 'Box-Cox','RMSE', 'R^2'.

B = mbcboundary.Fit(X,Type) creates and fits a boundary model to the data X, a double matrix. B is

an mbcboundary.Model object.

Examples

statistics = Fit(knot)

statistics =

27.0000

7.0000

1.0000

3.0184

2.6584

- suryUploaded byKirthi Raman
- Math10 Tg u2Uploaded byRia_Liza_Chico
- Interpolate Values Using the FORECAST Function - Excel Off the GridUploaded bytoanvmpetrologx
- MIMO_MPCUploaded bychoc_ngoay1
- Math 1B Berkeley Spring 2012Uploaded byBilly Ho
- Solving Polynomial Inequalities by GraphingUploaded bytarun gehlot
- Chapter 2Uploaded byMichael Racelis
- Introduction to Groups, In Variants, And Particles - F. FirkUploaded byw2006y
- 05640694Uploaded byashokgadu8
- Radar Data - 2012 LakshmananUploaded bycamilafuegos
- George Francis, John M. Sullivan and Chris Hartman- Computing Sphere EversionsUploaded byGremnDL
- D3D Driving Cars InstructionsUploaded byTialoc
- Indecomposability of polynomials and related Diophantine equations.pdfUploaded byhumejias
- Ec1 Uk AnnexUploaded byLanKan
- UntitledUploaded byapi-162647407
- Control System Using MATLAB (12.10.2012)Uploaded byIamzura Abdullah
- Ayman Review Ch_02Uploaded byEdward Smith
- Graphical Representation of DataUploaded bySanketBhalodia
- Several Variables OrthogonalUploaded bytasos_rex3139
- 00968600Uploaded bysuchi87
- Data Structures JournalUploaded bySaima Saima
- Afghanistan PrecipUploaded byLuis Lorenzo Rodriguez Rojas
- Cheb Yshev NodesUploaded bydwjang
- helsinki.pdfUploaded byvarun rai
- Spline InterpolationUploaded byrod8silva
- Mws Gen Inp Ppt QuadraticsplineUploaded byqwerty

- Fuel gain exceeding unity in an inertially confined fusion implosionUploaded byslacka123
- Wind Energy 2003 Landberg LUploaded byAnonymous XedXnFBz0I
- NaBH4-2015Uploaded byAnonymous XedXnFBz0I
- Sword Art Online SS Sound of the Water, Sound of the Hammer (Completo)Uploaded byAnonymous XedXnFBz0I
- Ejercicios Distr N OrmUploaded byAnonymous XedXnFBz0I

- (A4)FIRST-PAGE-RES-FINAL-12-2-16.docxUploaded byJoveth C. Candelario
- porting3Uploaded byYosoyIo
- 4Uploaded bynuwan01
- Linear Program Ver11Uploaded byRyan Ko
- GATE CS Tips !! _ Whiteswami's BlogUploaded byKapil Tirode
- Sampling Hyrule: Sampling Probabilistic Machine Learning for Level GenerationUploaded bya4104165
- ElectricalUploaded byAashiz Poudel
- ICH_Q2BUploaded byalinerhc
- PHY10 Lesson 2 Kinematics (Full)Uploaded byJohn Luke Cruz
- StiffnessUploaded byanitatippanagoudar
- Calculation of RegrattionUploaded bykrishan murari
- Chapter 4Uploaded byJoseph Campit
- CU230PUploaded byKundan Srivastav
- Defining Business Rules - What Are They ReallyUploaded bysicazoR
- Assessed 3Uploaded byDaniela Salgado Medina
- Week 17 STI52 TNT Converting Pressures to Nodal ForcesUploaded byDeepak Chachra
- T-18 NCHRP 12-81 Fatigue on the ServiceabilityUploaded byghadasaudi
- Remote Sensing and Image InterpretationUploaded byUlisses Alencar
- Doctorblademetering 140522064831 Phpapp02 (1)Uploaded byRafael Borges
- Atpdraw User ManualUploaded byfancpuintel2
- Risk AnalysisUploaded bydolly
- BEAM Description. Comparison With Classical MWUploaded byBeamPrivacy
- Sparse Madasatrix SudokuUploaded bynkapre
- Area Under GZ Curve - Boat Design ForumsUploaded byMuhammad Anis Basiran
- DRAFTING SETTINGS (AutoCAD)Uploaded byRazi Baig
- Kirchoff LawsUploaded byGrimmo1979
- 75_78_MET_54_1Uploaded byMostafaGaber
- MB403D Strategic Management of Technology & InnovationUploaded byAnmol Jakhmola
- EM Tutorial I With AnswersUploaded byvennila-puvi
- Fuzzy Based Control Using Labview for Miso Temperature ProcessUploaded byesatjournals

## Much more than documents.

Discover everything Scribd has to offer, including books and audiobooks from major publishers.

Cancel anytime.