How do I fit a curve to the peaks of the data?

44 ビュー (過去 30 日間)
Rukundo Wellen
Rukundo Wellen 2023 年 3 月 31 日
回答済み: Star Strider 2023 年 3 月 31 日
I have tha above data and I need to fit a curve based on the peaks to get something like as shown below

回答 (2 件)

Aditya Srikar
Aditya Srikar 2023 年 3 月 31 日
Hi Rukundo Wellen
Curve Fitting Toolbox contains functions for fitting curves and surfaces to data.
You can fit the curve to the peaks of data by using fit() function.
Based on characteristics of data, you can use library models like gaussian, fourier, polynomial, sin etc to obtain more precise curves.
You can refer the documentation for implementation details
Hope it helps.

Star Strider
Star Strider 2023 年 3 月 31 日
The approach depends on the result you want from the curve.
If you want parameters, then findpeaks or islocalmax will be necessary to define the peaks, then use polyfit and polyval to fit them and return the fitted curve and the appropriate parameters.
If you only want the curve itself, the envelope function using the 'peaks' option could work.

カテゴリ

Help Center および File ExchangeCurve Fitting Toolbox についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by