日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

MATLAB函数拟合使用

發布時間:2024/8/1 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 MATLAB函数拟合使用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1 函數命令擬合

最常用的函數擬合命令為fit,語法為|

[擬合結果 擬合精度]=fit(X數據,Y數據,‘擬合類型’)

其中,具體的擬合類型可以參看幫助文檔,也可以使用fittype來自定義新的函數類型,比如定義擬合函數a*x+b*x^2+exp(4*x);|

newtype=fittype('a*x+b*x^2+exp(4*x)') ; fit(x,y,newtype);x=[1;2;3;4;5]; y=[2;3;4;5;6];

2 使用界面啟動擬合工具箱

具體操作步驟

  • 在APP一欄,選擇curve fitting工具箱,然后選擇相應階段的數據,填入X data和Y data
  • 在fit options一欄選擇對應的函數形式,階數,和魯棒性
  • 點擊工具欄的residuals plot,便于觀察擬合誤差
  • 點擊工具欄的data cursor,可以用鼠標在曲線上標記出具體的坐標值

  • 3 界面介紹

    • 頂部為常用工具欄,常用的一般有誤差分析和鼠標標記坐標點
    • Fit Options可以選擇擬合類型和函數次數
    • 左側Results顯示了擬合結果的性能參數
    • 底部的table of fits可以對多個不同的擬合結果進行性能比較

    4 擬合類型

    擬合類型解釋
    Custom Equations用戶自定義的函數類型
    Exponentialexp指數逼近,有2種類型, a*exp(b*x)、 a*exp(b*x) + c*exp(d*x)
    Fourier傅立葉逼近,有7種類型,基礎型是 a0 + a1*cos(x*w) + b1*sin(x*w)
    Gaussian高斯逼近,有8種類型,基礎型是 a1*exp(-((x-b1)/c1)^2)
    Interpolant插值逼近,有4種類型,linear、nearest neighbor、cubic spline、shape-preserving
    Polynomial多形式逼近,有9種類型,linear ~、quadratic ~、cubic ~、4-9th degree ~
    Power冪逼近,有2種類型,a*x^b 、a*x^b + c
    Rational有理數逼近,分子、分母共有的類型是linear ~、quadratic ~、cubic ~、4-5th degree ~;此外,分子還包括constant型
    Smoothing Spline平滑逼近
    Sum of Sin Functions正弦曲線逼近,有8種類型,基礎型是 a1*sin(b1*x + c1)
    Weibull只有一種,a*b*x^(b-1)*exp(-a*x^b)

    5 擬合結果說明

    例如在上面的擬合中,選擇Polynomial類型,Degree選擇3階,Robust選擇Off,得到的Results如下:

    Linear model Poly3:f(x) = p1*x^3 + p2*x^2 + p3*x + p4 Coefficients (with 95% confidence bounds):p1 = 0.0007776 (0.0007486, 0.0008066)p2 = -0.121 (-0.1258, -0.1161)p3 = 6.324 (6.055, 6.592)p4 = -107 (-111.9, -102)Goodness of fit:SSE: 0.555R-square: 0.9973Adjusted R-square: 0.9973RMSE: 0.03777

    其中,Goodness of fit里面的性能指標如圖所示:

    性能指標解釋
    SSEThe sum of squares due to error. This statistic measures the deviation of the responses from the fitted values of the responses. A value closer to 0 indicates a better fit.
    R-squareThe coefficient of multiple determination. This statistic measures how successful the fit is in explaining the variation of the data. A value closer to 1 indicates a better fit.
    Adjusted R-squareThe degree of freedom adjusted R-square. A value closer to 1 indicates a better fit. It is generally the best indicator of the fit quality when you add additional coefficients to your model.
    RMSEThe root mean squared error. A value closer to 0 indicates a better fit.

    6 參考文獻

  • 函數擬合工具包 [Fudan Physics Teaching Lab]
    http://phylab.fudan.edu.cn/doku.php?id=howtos:matlab:mt1-5
  • Matlab的曲線擬合工具箱CFtool使用簡介 - yousun - 博客園
    https://www.cnblogs.com/yousun/p/3450676.html
  • 總結

    以上是生活随笔為你收集整理的MATLAB函数拟合使用的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。