How to fit a base(excluding the peak) of a curve and subtract the fitted base with its corresponding unfitted curve

조회 수: 20 (최근 30일)
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
Ankit Gupta
Ankit Gupta 2015년 9월 29일
편집: Ankit Gupta 2015년 9월 29일
This is the raw single dataset, I just wanna fit the baseline excluding the peak data point form 10:22 Mat file contains "Tabs" as ydata and freq as xdata
dpb
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
Image Analyst 2015년 9월 28일
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
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
Ankit Gupta 2015년 9월 29일
Hi dpb, datasets are attached , its 2101x32 double(ydata) and freq is 1x32 double (xdata)
Ankit Gupta
Ankit Gupta 2015년 9월 29일
편집: Ankit Gupta 2015년 9월 29일
mat file Hi Attached the mat file, in the Mat file "Tabs" is the y data and Freq is the x data

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by