MATLAB: How to do a baseline correction

baseline correction

Hello everyone,
I have an experimental data as shown in the figure, I need to do a baseline correction, in a way that the black line that I drew in the picture becomes horizental. Can any of you help me to do it in MATLAB?DSCdata1.png

Best Answer

You mean like a simple subtraction?
t=linspace(0,10,100);
bias=@(t) t/9;
P_fun=@(t) 0.1*(t-3).^2+sin(t/2)-0.85 +bias(t);
P=P_fun(t);
%subtract bias
P_new=P-bias(t);
plot(t,P,'b',t,bias(t),'k',t,P_new,'r')