曲线拟合器Curve Fitting Toolbox

matlab数据分析之曲线拟合器Curve Fitting Toolbox



参数拟合

参数拟合涉及查找适合数据的一个或多个模型的系数(参数)。假设数据本质上是统计数据,可以分为两个部分:

data = deterministic component + random component//确定性成分+随机成分 

确定性成分由参数模型给出,随机成分通常被描述为与数据相关的误差,即:

data = parametric model + error

该模型是自变量(预测变量)和一个或多个系数的函数。误差表示数据中遵循特定概率分布(通常为高斯分布)的随机变化。变化可能来自许多不同的来源,但当您处理测量数据时,它们总是以某种程度存在。系统变异也可能存在,但它们可能导致拟合模型不能很好地代表数据。模型系数通常具有物理意义。
Curve Fitting Toolbox™ 参数化库模型在以下部分中进行了描述

一、Select Model Type

可选择的拟合模型

二、Center and Scale Data

Curve Fitter 应用程序中的大多数拟合在“拟合选项”窗格中提供“居中”和“缩放”选项。当您选择此选项时,应用程序会重新拟合模型,使数据居中并按比例缩放。在命令行中,使用 fitoptions 函数并将 Normalize 选项设置为“on”。要缓解不同尺度变量的数值问题,请规范化输入数据(也称为预测数据)。

例如,假设您的表面拟合输入是范围为 500-4500 r/min 的发动机转速和范围为 0-1 的发动机负载百分比。然后,center 和 scale 通常会提高拟合度,因为两个输入之间的尺度差异很大。但是,如果您的输入采用相同的单位或相似的比例(例如,地理数据的东距和北距),则中心和比例的用处不大。当您使用此选项对输入进行归一化时,与原始数据相比,拟合系数的值会发生变化。如果您正在拟合曲线或曲面来估计系数,或者系数具有物理意义,请清除中心和比例复选框。 Curve Fitter 应用程序中的绘图始终使用原始比例,无论中心和比例状态如何。在命令行中,要在拟合之前居中和缩放数据,请使用 fitoptions 函数和 options.Normal 指定为“on”来创建选项结构。然后,使用具有指定选项的拟合函数。

三、Specify Fit Options and Optimized Starting Points

可以在拟合选项窗格中以交互方式指定拟合选项。除插值(Interpolant )和平滑样条线(Smoothing Spline)外,所有拟合都具有可配置的拟合选项。可用选项取决于所选的拟合(即线性、非线性或非参数拟合)。

  • 此处描述的选项可用于非线性模型。
  • 下系数约束和上限系数约束是多项式(Polynomial)拟合的拟合选项窗格中唯一可用的拟合选项。
  • 非参数拟合(即插值(Interpolant)、平滑样条曲线(Smoothing Spline)和局部加权(Lowess)拟合)没有“高级选项”。

此处显示了单项指数拟合的拟合选项窗格。系数约束值适用于人口普查数据。
在这里插入图片描述

拟合方法与算法

  • 方法 Method
    • 应用会根据您使用的拟合度自动选择“方法”值。对于线性拟合和非线性拟合,方法值分别为线性最小二乘法和非线性最小二乘法。
  • 鲁棒Robust 使用鲁棒最小二乘拟合方法的选项
    • Off — 不使用鲁棒拟合(默认)。
    • On — 拟合默认稳健方法(双平方权重)。
    • LAR — 通过最小化最小绝对残差 (LAR) 进行拟合。
    • 双平方(Bisquare ) —通过最小化残差的平方和进行拟合,并使用双平方权重减少异常值的权重。在大多数情况下,此选项是坚固安装的最佳选择。
  • 算法
    • Trust-Region 此选项是默认算法,如果指定系数下限或上限约束,则必须使用此选项。
    • Levenberg-Marquardt 如果信任区域算法不能产生合理的拟合,并且您没有系数约束,请尝试 Levenberg-Marquardt 算法。

有限差分参数

DiffMinChange — 有限差分雅可比系数的最小变化。默认值为 10-8。
DiffMaxChange — 有限差分雅可比系数的最大变化。默认值为 0.1。

请注意,DiffMinChange 和 DiffMaxChange 适用于:

  • 任何非线性自定义方程,即您编写的非线性方程
  • 曲线拟合工具箱 DiffMinChange 和 DiffMaxChange提供的某些非线性方程

不适用于任何线性方程。

拟合收敛准则

MaxFunEvals — 允许的最大函数(模型)计算数。默认值为 600。
MaxIter — 允许的最大拟合迭代次数。默认值为 400。
TolFun — 用于涉及函数(模型)值的停止条件的终止容差。默认值为 10-6。
TolX — 用于涉及系数的停止条件的端接容差。默认值为 10-6。

系数参数

Coefficients — 要拟合的未知系数的符号
StartPoint — 系数起始值。默认值取决于拟合。对于 Rational、Weibull 和自定义拟合,默认值是在 [0 1] 范围内随机选择的。对于“拟合类型”库中的所有其他非线性模型,起始值取决于数据集并通过启发式计算。
Lower - 拟合系数的下限。 App 仅将这些边界与置信域拟合算法结合使用。 “拟合选项”窗格中大多数拟合的默认下限是 -Inf,这表示系数不受约束。但是,一些模型具有有限的默认下限。例如,对于高斯拟合,App 会限制宽度参数,使其不能小于 0。
Upper — 拟合系数的上限。 App 仅将这些边界与置信域拟合算法结合使用。 “拟合选项”窗格中所有拟合的默认上限为 Inf,这表明系数不受约束。

Optimized Starting Points and Default Constraints

下表显示了拟合类型窗格中拟合的默认系数起点和约束。如果对起点进行了优化,则会根据当前数据集启发式计算它们。随机起点在区间 [0 1] 上定义,线性模型不需要起点。如果模型没有约束,则系数既没有下限也没有上限。您可以通过在“适合选项”窗格中提供自己的值来覆盖默认起点和约束。
在这里插入图片描述

ct. 18, 1995 v. 1.00 =========================================================================== + First release of CurveExpert 1.0. Oct. 26, 1995, v. 1.01 =========================================================================== New Features: + More attractive help file, with more keywords for searching + new help search facility available directly from CurveExpert Bug Fixes: + If a polynomial was already calculated, selecting another polynomial of a differing degree incorrectly pulled results from the cache instead of recalculating the curve fit. Fixed. + running two versions of CurveExpert is prevented, since two simultaneous instances cause stack faults. + if the data set is sorted, all interpolations are now marked invalid as they should be. + "Apply to All" did not necessarily force the current attributes of a graph to the current graph (only if the user clicks OK). Fixed. + The scrollbar did not get reset to the top when the user read in a new data file. Fixed. + The structure of the code has been undergone some major changes to ease porting to Windows 95 and Windows NT. I was exceedingly careful, but I hope this didn't introduce new bugs! :-) + For some reason, the help file didn't have any single or double quotes in it. This has been corrected, so it is now easier to read. + The help file was not terminated when CurveExpert was. Fixed. + The Window and Help menus were moved to more conventional positions on the menu bar. Nov. 4, 1995, v. 1.10: =========================================================================== New Features: + Previously undocumented logical functions can be used in the user-defined models. See the help documentation. + Current filename now appears in the title bar. + QuickCalc has been expanded to find the x-value, given the y-value. + Optimizations have been applied to many routines, making the user interface more responsive and the algorithms quicker. Changes: + File reading system has been revamped. + the color scheme on all windows now conforms strictly to the user defined system colors. + Dialogs were expunged of all Borland controls (except for buttons) since they conflicted with user defined color schemes. + The QuickCalc dialog now automatically shifts focus back to the edit control and selects all text after the OK button is pushed. This makes it easier to calculate many points at a time. Bug Fixes: + pressing the tab key to force the built-in spreadsheet sometimes added points onto the end of the data set. Fixed. + If a graph window was closed and then reopened (except after a CurveFinder operation), the comments in the Graph Info dialog were not correct. Fixed. + The Cut Last Row/Undo pair now functions properly. + The the graph of a polynomial fit would be reset if the data was changed in the data window. Fixed. + The scaling procedure did not grab the latest data out of the data window's edit control if it was active, resulting in one point not being scaled or translated. Fixed. + A constant starting with a decimal (eg, .25) caused CurveExpert to bomb (when defining a user model). This has been fixed so that these constants are accepted. + A comma-delimited data file was not read correctly. A new file reading system was implemented to read files with any type of (unspecified) delimiter between the data columns + if a data file was not read correctly, the filename in the status bar showed the unreadable file instead of the previous file. Fixed. + the common dialogs (file open/save, print) did not accept keystokes until after they were clicked with the mouse, which makes it terribly hard for non-mouse users. Fixed. + If the current path was changed from CurveExpert, the help file was not found. Fixed. Nov. 9, 1995, v. 1.11 =========================================================================== New Features: + the data point markers on graphs can now be changed to filled or unfilled circles, squares, triangles, pluses, or crosses. Changes: + Small optimizations made to the speed of the user interface + The main window is now fully resizable + The position and size of the main window is saved on exit and restored the next time CurveExpert runs Bug Fixes: + Whoops! The new file reading procedure masked out all minus and minus signs in the data, so that numbers like -10 and 10e-3 were not read correctly. Fixed. + the exception reporting dialog box did not properly draw the exclamation point's background, which should match the dialog color. Fixed. + the single-precision version still read files incorrectly sometimes. Fixed. + the initial guess dialog sometimes opened unconditionally on the next fit performed after a CurveFinder evaluation. Fixed. Nov. 13, 1995, v. 1.12 =========================================================================== New Features: + Differentiation and integration of a calculated curve fit is now supported, similar to the implementation of QuickCalc. Changes: + If background processing is enabled, during iteration the cursor is a combined arrow/hourglass to inform the user that he/she can still perform operations. + editing points in the spreadsheet is now prohibited while any iteration is taking place. + Drawing of data points on a graph is internally clipped if it is outside of the graphing window. This allows for faster graph drawing if many points are outside of the graph pane. + A separate set of application-wide defaults are maintained for the single-precision and double-precision versions (registered version only) Bug Fixes: + Periods by themselves in the user models were parsed as the value zero instead generating a syntax error. Fixed. + A plot that was copied to the clipboard failed to "clip" data points that were outside of the graphing pane, resulting in points being drawn outside of the intended area. Fixed. + The information button on a graph window would sometimes disappear if a window was sized smaller. Fixed. + After copying a plot to the clipboard, the current graph resolution was incorrectly reset to 1. Fixed. + Extremely small parameter guesses were not allowed in the parameter guess dialog, since its precision was limited to six places. Fixed. Nov. 25, 1995, v. 1.13 =========================================================================== Changes: + The data manipulation tools have now been merged into one organized, tabbed dialog. + The model analytical tools have now been merged into one organized, tabbed dialog. + Cascading a large number of windows would sometimes result in some windows being moved off of the screen. Now, the cascade restarts at the top left if a window might be moved off-screen. + The built-in models have been reordered so that operations such as calculations and window manipulations naturally fall into a grouped arrangement. + the graph autoscaling algorithm has been rewritten to be more reliable + The info button on the graphing window has been changed and moved to be less obtrusive. + sizing restrictions on the graphing windows have been removed. Bug Fixes: + Whoops! Another problem with the file reading engine caused columns starting with a negative number to be discarded. Fixed. + Entering a user model with no parameters was allowed when it shouldn't have been. Now, a syntax error is generated. + the Window|Tile command sometimes worked strangely if graphing windows had been closed prior to invoking it. Fixed. + the Window|Cascade command did not properly cascade windows that were minimized. Fixed. + the last tick and label sometimes wasn't shown on the x/y axes of plots. Fixed. + the implementation of filled points didn't produce a filled entity for the circle or triangle when printed. Fixed. + The user was still asked whether to save a file or not upon exiting, even if the file had just been saved. Fixed. + CurveExpert will now run even if ctl3dv2.dll is not found. Dec. 2, 1995, v. 1.14 (Shareware Only) =========================================================================== Bug Fixes: + Graph Attributes/Graph Scaling Dialogs were not initialized properly in the Shareware version. Fixed. Dec. 31, 1995, v. 1.15 (Not Released) =========================================================================== Changes: + Sometimes, resizing a graph would result in the line width being drawn incorrectly (not the user-specified line width, screen only). Fixed. + delayed rendering of plots is now supported, to greatly increase drawing performance with user model plots and/or plots with a large number of data points + (registered only) the single precision package has now been optimized for single-precision arithmetic + the directions on the graph window are now removed if they will be collide with the error information. This leads to cleaner plots, especially with small graphing windows. Bug Fixes: + if one minor tick was selected (on either axis), there was a chance that one too many tick labels would be printed. Fixed. + some stray (and inappropriate) directions were left on the differentiate and integrate dialogs. Removed. Jan. 14, 1996, v. 1.20 =========================================================================== New Features: + many new graphing features and easier-to-use graphing properties interface has been added + the covariance matrix and residual plot are now available in the revamped information dialog + much faster nonlinear regression performance over version 1.1 (between 17% to 45% improvement in speed, depending on the number of parameters) Changes: + each graphing window no longer appears in the Win31 tasklist; and each window no longer shows up in the Win95 taskbar. + weighting values by 1/y^2 during nonlinear regression is now implemented Jan. 25, 1996, v. 1.21 =========================================================================== Bug Fixes: + the equation bitmaps in the initial guess and/or information dialog did not update properly at times. Fixed. + if the ctl3dv2 module could not be loaded, the info dialog GPF'ed when opened. Fixed. March 5, 1996, v. 1.22 =========================================================================== New Features: + the Preferences dialog has been revamped, with many new user- defineable options added for printing, regression/math options, and application options. + added right-click menus to all main window regions Changes: + The limitation of two-line titles in metafiles has been removed. + new and improved debugging console with a nicer appearance and more information. Necessary because of the ongoing port to Win32. + a button that coordinates the foreground (frame) color and the text colors was added to the graph properties dialog + the ability to draw grid lines at each minor tick mark was added + drag-and-drop from the file manager to CurveExpert is now supported + data information dialog box was widened to accommodate large numbers. + a new and much faster data clipping algorithm is now used + clipping and sorting operations now take place in the background, instead of hogging the CPU + two new symbols added to the graphing properties dialog Bug Fixes: + if the "Weight by Y^2" option was turned on, the results of nonlinear regression were likely to be a local minima or not converge at all. Fixed. + It was not possible to put a single percent sign in an axis label without typing '%%' in the axis label edit field. Fixed. + if the graph extents were set just right on the x or y axis, then one grid line would not draw. Fixed. + if the main window was minimized when CurveExpert was exited, the window was not restored to the correct position the next time CurveExpert was run. Fixed. + a GPF occurred if a data set with over 8192 data points was sorted. Fixed. + corrected an erroneous reading of the allocated memory (in bytes) that occurred if the quadratic fit was ever used. + if a residual table of an extremely large data set was copied to the clipboard in the info dialog, a GPF occurred. Fixed. + if a large data file with very large numbers was read, the first examination of that file would cause a program abort due to an overflow. Fixed. May 20, 1996, v. 1.23 =========================================================================== New Features: + 32 BIT VERSION FOR WINDOWS 95 AND WINDOWS NT RELEASED! + added x/y averages, minima, maxima, and standard deviations to the variables available for custom regressions + added the capability to swap the x and y data + (32 bit only) new tooltips feature gives quick access to a toolbar button's function Changes: + All BWCC controls have been removed, and as a result, several dialogs were redesigned. This gives a more consistent feel to the application, eases the port to Win32, and frees CurveExpert from having the BWCC.DLL library distributed with it. + (16 bit only) draws the missing line between the toolbar and menus if running under Windows 95. + added code to properly shut down CurveExpert if the user logs off while it is running. + fit type has been added to the caption of a residual plot window to make it clear where the window originated. + even if no changes were made to the graph from the Graph Properties dialog, the plot was re-rendered. Now, a check is made to see if any changes were made to determine if the graph should be redrawn. + the help file has undergone some formatting changes and additions + support for multiple-copy printouts was added Bug Fixes: + the table-generation and export-file mechanisms printed all zeros if a number was too small. Fixed. Now, the numbers are printed properly in exponential format. + the Preferences dialog would cause a program abort if no printer was installed. Fixed. + the function that draws the graph title had a potential memory leak. This would manifest itself also in the Residual page from the information dialog. Fixed. + the path field in the application preferences dialog would not allow horizontal scrolling, so the user was limited to a short data file path name. Fixed. + the ranking chart would sometimes get corrupted during a CurveFinder operation on a small data set (at unpredictable times). Fixed. + the underline style was ignored if it was specified for a font that would appear on a graph. Fixed. + a memory leak that caused a "floating point error" in the lagrangian interpolation routine was fixed + if a x or y axis label contained more than 50 characters, a subsequent display of the plot would cause a crash. Fixed. June 2, 1996, v. 1.24 =========================================================================== Changes: + when the 32-bit version opened a help file under Win32s, it went straight to the help file contents. Now, it opens the help file contents dialog box. + while reading a file, the progress is reported in the status bar Bug Fixes: + under Windows NT, all of the tabbed dialog boxes (preferences, graph properties, graph analyze, graph information) were blank. Fixed. + the history (dump) file did not have the last iteration written to it if the iteration converged. Fixed. + CurveExpert might not detect that it is running under Win32s correctly. Fixed. + if a line in a data file started with a +, it was not recognized as a number. Fixed. November 7, 1996, v. 1.30 =========================================================================== New Features: + uncertainties (standard deviations) in each data point can now be used + built-in spreadsheet facility has been enhanced -- now looks and behaves *much* more like a spreadsheet + spreadsheet facility has multilevel undo/redo capability + cut/copy/paste of ranges in the built-in spreadsheet and between other spreadsheets (Excel, Quattro Pro, etc.) is now implemented + enhanced file import facility gives more flexibility for reading data files + a most-recently-used file list is maintained in the File menu + [32-bit, '95 interface only] Internet-aware links in the Help menu directly access the CurveExpert home page(s) Changes: + the splash screen is now drawn in the correct user-defined color, instead of being hard-coded to light gray. + the graphs now comply with the user-defined color scheme unless set explicitly by the user. + there is no longer any limit on the number of data points that can be entered manually (previously 100) + the main window now responds appropriately when certain system settings change, such as the scroll bar width + more info was added to the debugging facility + the status bar now shows what degree of polynomial is being computed + some menu items have been rearranged to form a more consistent user interface + if the file is modified, an asterisk appears beside the filename in the title bar; when the file is saved, the asterisk is removed + typing a title in the "Graph Properties" dialog now automatically deselects the "Show Header" checkbox. Bug Fixes: + certain curve fits were turned off when they shouldn't have been if zeros or negatives existed in the x data. Fixed. + strange "NAN"s would occasionally appear in the released 32-bit version. This was due to a Microsoft optimizer bug; a workaround has been implemented. + On Windows NT, if a table file was to overwrite an already existing file, CurveExpert would terminate. Fixed. + if a two-column data file had a one-column entry later in the data file, CurveExpert would crash. Fixed. + an internal error that might cause a termination while using the CurveFinder was fixed + CurveExpert would crash soon after invoking the preferences dialog, if the polynomial window was open and the degree in it did not match the selected degree in the preferences dialog + the CurveFinder tool now correctly handles polynomial calculations when the Polynomial family is selected + if a data set line began with spaces or tabs, it could be misinterpreted as having one more column than it did. Fixed. + the help button for the ArcLength page in the "Analyze Graph" dialog did not work. Fixed. + the new-style help is now used unter Windows NT 3.51 by default + if a malformed file was attempted to be read, the toolbar was (mistakenly) reenabled anyway. Fixed. + various and sundry misspellings, typos, and formatting errors have been corrected in the on-line documentation. November 18, 1996, v. 1.31 =========================================================================== Changes: + [32-bit only] Bessel functions of first and second kind added to available user model functions + ceil and floor functions added to available user model functions Bug Fixes: + [32-bit only] When installing to a WinNT 3.51 platform. no Program Manager group and icons would be created unless the user was the administrator. Fixed. + [16-bit only] If a math error occurred and was handled in CurveExpert and 3d dialogs were being used, dialogs became transparent and unusable until CurveExpert was restarted. Fixed. February 24, 1997, v. 1.32 =========================================================================== New Features: + A history page has been added to the Graphing Information dialog to give the chi-square and parameter histories for each regression. + a preview plot gives quick access to visualization of various regressions on the ranking chart Changes: + if the y column is scaled and STD data is also present, the STD data is scaled by the same factor as the y column + the ranking chart interface has been changed to mesh smoothly with the preview plot + comments in the information dialog were not available after running CurveFinder or closing/reopening a window. This data is now stored with the fit coefficients, so the comments are available at any time for a valid curve fit result + various speedups implemented in the nonlinear regression routine Bug Fixes: + when sorting data and the standard deviation column is active, the STD data would not be carried with the data point. Fixed. + if pasting more than 25 points, CurveExpert would freeze. Fixed. + Several memory and resource leaks fixed. + if an exception occurred when plotting a graph, the message stating so would be misplaced on the window/metafile/printout. Fixed. + the keyboard interface on the File Import Dialog was nonexistant. Added. + After clipping the data set, if the user tried to undo a previous action, CurveExpert would crash. Now, the undo is disabled in this situation. + When dragging and dropping a file on CurveExpert, the title of the file became "TITLE.ERR". Fixed. + when a file was opened off of the MRU menu or dropped on CurveExpert, it could not be saved to the same file. Fixed. February 26, 1997, v. 1.33 =========================================================================== Bug Fixes: + For users with an international version of Windows where the comma is used for the decimal point, CurveExpert would not read files properly. Fixed. + In help file, correlation coefficient was documented incorrectly. Corrected. March 19, 1997, v. 1.34 =========================================================================== Bug Fixes: + [16 bit only] plots with a log x axis were not plotting correctly. Fixed. + Corrections made to keyboard interface in File Import Dialog. March 1, 1998, v. 1.36 =========================================================================== New Features: + a facility to transform a column of data at a time by selected functions was added Changes: + the initial viewable state of the CurveExpert window now reacts correctly to external control of the process spawning it + a switch was added to toggle the solid line at X=0 and Y=0 on the graph + some additions and changes to the help documentation Bug Fixes: + a 19th order polynomial fit caused a crash; fixed. Jan 1, 2001, v. 1.37 ============================================================================ Changes: + updates to address and payment information June 13, 2003, v. 1.38 ============================================================================ New Features: + added setting to curves.ini file to allow international users to set the decimal point appropriately based on their locale Changes: + Updated contact information and order form
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值