Code:
d=load('CU_Ventricular_Tacharrhythmia\cu01m.mat');
noisyECG_withTrend=d.val(1,:);
subplot(2,1,1), plot(noisyECG_withTrend), grid on,
nnoisyECG_withTrend = noisyECG_withTrend';
t = 1:length(noisyECG_withTrend);
[p,s,mu] = polyfit((1:numel(noisyECG_withTrend))',nnoisyECG_withTrend,6)
f_y = polyval(p,(1:numel(noisyECG_withTrend))',[],mu);
ECG_data = nnoisyECG_withTrend - f_y; % Detrend data
subplot(2,1,2), plot(t,ECG_data); grid on
%ax = axis;
%axis([ax(1:2) -1.2 1.2])
title('Detrended ECG Signal')
xlabel('Samples'); ylabel('Voltage(mV)')
legend('Detrended ECG Signal')

댓글 수: 1

Explorer
Explorer 2016년 2월 19일
편집: Explorer 2016년 2월 19일
Basically, I am trying to remove baseline error so that I can extract features like R to R delay and other intervals.

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

 채택된 답변

Star Strider
Star Strider 2016년 2월 19일

0 개 추천

See if this filter does what you want (assuming Fs=256):
Fs = 256;
Fn = Fs/2;
Wp = [1 90]/Fn;
Ws = Wp.*[0.5 1.25];
Rp = 1;
Rs = 20;
[n,Wn] = buttord(Wp,Ws,Rp,Rs);
[b,a] = butter(n,Wn);
[sos,g] = tf2sos(b,a);
figure(1)
freqz(sos, 2048, Fs);

댓글 수: 5

Explorer
Explorer 2016년 2월 23일
Yes, it works in removing baseline errors.
Star Strider
Star Strider 2016년 2월 23일
I was quite definitely hoping it would.
Evenor
Evenor 2018년 10월 16일
Can you please comment-in and explain how this filter works? Some of the functions used in it, like 'buttord', do not appear in my MATLAB2014a documentation, so can you elaborate on them (in what toolbox/version they are available and what they do)? Thanks.
Star Strider
Star Strider 2018년 10월 16일
@Evenor —
My code uses functions from the Signal Processing Toolbox. You need to have it installed in order to run my code. You should be able to run it in R2014a.
Sibi Ramachandran
Sibi Ramachandran 2019년 2월 13일
@Star Strider Good morning sir I saw your comments and it helped me to understand the use of these filters. I recently posted a question and I was wondering if you would be able to help me also? Thank you so much!

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

추가 답변 (0개)

카테고리

질문:

2016년 2월 19일

댓글:

2019년 2월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by