Pregunta

I have 2 column of vectors which are Position and Time. After I plot the position vs time as you could see in the picture it is tilted wave shape which is true according my data. I would like to have this wave shape in the straight line not tilted like below figure. Could I convert this shape to straight line wave?

Thanks enter image description here

¿Fue útil?

Solución

there is this tutorial on peak analysis in the mathworks docs which discribes(in a sitenote) how to detrend data (by doing what Dan suggested):

load noisyecg.mat
t = 1:length(noisyECG_withTrend); 
plot(t,noisyECG_withTrend)        %load the data with trend

[p,s,mu] = polyfit((1:numel(noisyECG_withTrend))',noisyECG_withTrend,6);
f_y = polyval(p,(1:numel(noisyECG_withTrend))',[],mu);     %fitting a polynom in that data

ECG_data = noisyECG_withTrend - f_y;        % Detrend data by subtracting the values of said polynom
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top