How to fit a base(excluding the peak) of a curve and subtract the fitted base with its corresponding unfitted curve
古いコメントを表示
Hi all,
I am trying to fit a base of a curve(excluding peak form data point 10:22) using a polynomial expression, I want to programmatically fit the base line (excluding peak) and do the subtraction of the fitted and unfitted data.
Is there a way to fit just the base and exclude the peak data points(from 10:22)?
single datasets is attached.
3 件のコメント
Image Analyst
2015 年 9 月 28 日
Why not make it easy for us to give advice and attach a screenshot of the plotted data?
Ankit Gupta
2015 年 9 月 29 日
編集済み: Ankit Gupta
2015 年 9 月 29 日
dpb
2015 年 9 月 29 日
Despite the structure in the "baseline" outside the peak, without further information on the system you can't realistically fit much more than a linear baseline value in the region of the peak itself. When you use the polynomial of high order, there's not telling what it'll do in that region.
回答 (2 件)
Image Analyst
2015 年 9 月 28 日
1 投票
You forgot to attach the data. But anyway, maybe this: http://www.mathworks.com/matlabcentral/fileexchange/38841-matlab-implementation-of-harmonic-analysis-of-time-series--hants-
Or you can certainly extract everything except elements 10 to 22 and pass them into interp1(), polyfit(), or fitlm() and get a polynomial everywhere, even over the missing data points.
dpb
2015 年 9 月 28 日
But despite not having the data set for viewing/testing, sure...
ix=[1:9 23:length(x)]; % include points
b=polyfit(x(ix),y(ix),2); % fit second order baseline
ysub=y-polyval(b,x); % subtract baseline over entire range
5 件のコメント
Ankit Gupta
2015 年 9 月 28 日
Ankit Gupta
2015 年 9 月 28 日
dpb
2015 年 9 月 28 日
"I want to use the 8th degree polynomial fit" This is undoubtedly a very bad idea...it'll surely have many undesirable inflections. Would have to see the data to see just how badly it performs but I'm not surprised results aren't as expected.
Specifics will need the data; as IA says as a minimum if can't figure out the attachement for a file attach a sample plot.
Ankit Gupta
2015 年 9 月 29 日
Ankit Gupta
2015 年 9 月 29 日
編集済み: Ankit Gupta
2015 年 9 月 29 日
カテゴリ
ヘルプ センター および File Exchange で Descriptive Statistics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
