MATLAB MATRIX LABORATORY - PowerPoint PPT Presentation

1 / 40
About This Presentation
Title:

MATLAB MATRIX LABORATORY

Description:

????? ?????? BASIC FITTING. 2 ????? ?????? Curve Fitting Toolbox (CF TBX) ... Previewing and preprocessing data. Creating, comparing, and managing models ... – PowerPoint PPT presentation

Number of Views:38
Avg rating:3.0/5.0
Slides: 41
Provided by: cent203
Category:

less

Transcript and Presenter's Notes

Title: MATLAB MATRIX LABORATORY


1
????? ???????? ?????? ???? ???"? (2) ????? 7
??? ?''? ?????? ????????
2
?????? ??????????? ???????????? ???????
????? ??????
  • ???? ?????? ???????
  • ????? ?????? BASIC FITTING
  • 2 ????? ?????? Curve Fitting Toolbox (CF TBX)
  • 3 ????? ?????? ?? ??? DISTRIBUTION FITTING TOOL

3
????? ????? ?????? (Fitting)
?????? ????????????
4
????? ????? ??????(????)
  • Function approximation
  • -- method of least squares
  • -- minimize the residuals
  • -- given data of points have noises
    (uncertainty)
  • the purpose is to find the trend
    represented by data.
  • Function interpolation
  • -- approximating function match the given data
    exactly
  • -- given data of points are precise
  • the purpose is to find data between these
    points

5
?????? ???????
????? ????? ??????(???? 2)
6
????? ????? ??????(???? 3)
  • Minimizing Residuals (Errors)
  • minimum average error (cancellation)
  • minimum absolute error
  • minimal error (minimizing the maximum error)
  • least squares (linear, quadratic, .)

7
????? ????? ?????? (???? 4)
?????? ???????? Fitting a straight line to
observations Equation for straight line
Difference between observation and line ei is
the residual or error
Small residual errors Large residual errors
8
?????? ????????
??????? ???????
  • Minimize total square-error function sum of the
    squares of the residuals - Sr(a0 ,a1)
  • Solve for (a0
    ,a1)

9
??????? ??????? (????)
  • Minimize

10
??????? ??????? - ???????
  • Positive differences do not cancel negative
    differences
  • Differentiation is straightforward
  • Weighted differences
  • Small differences become smaller and large
    differences are magnified

11
??????? ??????? - ?????
  • Polynomial fit for
  • error function - erf(x)
  • x (0 0.1 2.5)'
  • y erf(x)
  • p polyfit(x,y,6)
  • f polyval(p,x)
  • table x y f y-fy-f absolute error
  • x (0 0.1 5)'
  • y erf(x)
  • f polyval(p,x)
  • plot(x,y,'o',x,f,'-')
  • axis(0 5 0 2)

12
?????? ??????? - ??????? (????)
  • Use sum( ) in MATLAB

13
??? ?????
  • Sum of squares of the residuals with respect to
    the mean
  • Sum of squares of the residuals with respect to
    the regression line
  • Coefficient of determination
  • Correlation coefficient

14
??? ????? (????)
  • Alternative formulation of correlation
    coefficient
  • More convenient for computer implementation

15
????? ?????? BASIC FITTING
  • ????? ?????? ???? ??
  • ???? ????? ???? ???? Basic Fitting
  • ???????? ???????
  • ???? ????? ??????

16
???????? ???????
  • Fit data using a spline interpolant, a
    shape-preserving interpolant, or a polynomial up
    to degree 10.
  • Plot multiple fits simultaneously for a given
    data set.
  • Plot the fit residuals.
  • Examine the numerical results of a fit.
  • Evaluate (interpolate or extrapolate) a fit.
  • Annotate the plot with the numerical fit results
    and the norm of residuals.
  • Save the fit and evaluated results to the MATLAB
    workspace.

17
???? ????? ??????
  • 1.Plot the data US Population (in millions of
    people)
  • 1790 3.9
  • 1800 5.3
  • 1810 7.2
  • 1820 9.6
  • 1830 12.9
  • 1840 17.1
  • 1850 23.1
  • 1860 31.4
  • 1870 38.6
  • 1880 50.2
  • 1890 62.9
  • 1900 76
  • 1910 92
  • 1920 105.7
  • 1930 122.8
  • 1940 131.7
  • 1950 150.7
  • 1960 179

2.Select Basic Fitting from the Tools menu of the
created plot.
18
???? ????? ?????? (????)
3.Press here and then press here
19
???? ????? ?????? (????2)
4. Sign the needed places, for instance 4th
degree polynomial ,Show equation , Plot residuals
Possible message
Sign Center and scale X data
20
???? ????? ?????? (????3)
6. You can specify a vector of x-values at which
to evaluate the new value of population. Enter
needed value (f.e. 2005) and then click Evaluate
and Plot evaluated results
21
???? ????? ?????? (????4)
7. You can save the evaluated data to the MATLAB
workspace by selecting the Save to workspace
button.
22
???? ????? ?????? (????5)
8. You can save the evaluated data to the MATLAB
workspace by selecting the Save to workspace
button.
23
????? ?????? ??? ?- CF TBX
  • ????? ?????? ???? ??
  • - ???????? ??????? ?? CF TBX
  • ???? ????. ???? ?????
  • ????? ?? ??? ????? ????????
  • ?????

24
???????? ??????? ?? CF TBX
  • The Curve Fitting Toolbox extends the MATLAB
    environment with integrated tools for
  • Previewing and preprocessing data
  • Creating, comparing, and managing models
  • Using a variety of standard and custom fitting
    models
  • Fitting with standard and robust methods
  • Analyzing fits
  • Nonparametric fitting using splines and
    interpolants
  • Interpolation, extrapolation, differentiation,
    and integration of fits
  • Introduction to Curve Fitting see here
  • http//www.mathworks.com/products/curvefitting/dem
    os.jsp

25
???? ????. ???? ?????
  • 1. Open Curve Fitting Tool
  • gtgtcftool

26
???? ????. ???? ????? (????)
2. Export Data for Fitting gtgtload census US
Population in 1790-1990
27
???? ????. ???? ????? (????2)
3. Open Data GUI Click on Data button in CFTOOL
28
???? ????. ???? ????? (????3)
  • 4. Fitting the Data with the Fitting GUI.
  • Click the Fitting button in the CV Tool window
  • In Fitting window
  • Fit Editor--gt New Fit.
  • Select f. e. quadratic polynomial
  • from the Polynomial list.
  • Name the fit as poly2.
  • Click the Apply button or select the
  • Immediate apply check box.
  • The library model, fitted coefficients,
  • and goodness of fit statistics
  • (sum of squares due to error - SSE,
  • R-square and Root Mean Squared
  • Error -RMSE)
  • are displayed in the Results area.

Copy fit for saving current fitting
29
???? ????. ???? ????? (????4)
  • 5.To wiew Results with residuals
  • In CF Tool window press View-gtResiduals-gtLine plot

30
???? ????. ???? ????? (????5)
  • 5.To exclude some points from the data
  • In CF Tool window press Exclude and then in
    Exclude window
  • Select data set -gt Check to exclude point and
    sign the points for exclusion

31
???? ????. ???? ????? (????6)
  • 5.To analyze the data
  • In CF Tool window press Analysis and then in
    Analysis window sign the needed properties for
    analyzing and press Apply button

32
???? ????. ???? ????? (????7)
  • 5.To save your work
  • In CF Tool window press File-gtGenerate
    M-file-gtFile Name-gtSave
  • For run the saved file
  • gtgt CFexample(cdata,pop) cdata,pop must be
    inputted before this command

33
????? ?? ??? ?????? ????????
  • Stages 1 3 from previous section.
  • Open the Fitting window.
  • Custom Equations -gt
  • Center and scale data (for better fit) -gt
  • New Equation

34
????? ?? ??? ????? ???????? (????)
  • 2.In Create Custom Equation window choose General
    Equation
  • In Equation enter needed equation, for example
  • Yae-bxcedx
  • In Equation name enter name

35
????? ?? ??? ????? ???????? (????2)
36
????? ?? ??? DISTRIBUTION FITTING TOOL
  • ????? ?????? ???? ??
  • ????? ????????? ? STATISTICS TBX
  • ??? dfittool

37
????? ?? ??? DISTRIBUTION FITTING TOOL
  • gtgtdata normrnd(.36, 1.4, 100, 1)
  • gtgtdfittool

38
????? ?? ??? DISTRIBUTION FITTING TOOL(????)
39
????? ?? ??? DISTRIBUTION FITTING TOOL(????2)
  • 4.

40
????? ?? ??? DISTRIBUTION FITTING TOOL(????3)
  • 4. Results
Write a Comment
User Comments (0)
About PowerShow.com