My signal level is strange.

1 view (last 30 days)
Ken
Ken on 17 Jul 2012
x is my .csv file.
I using Pan & Tompkins 1985 QRS detecter paper.
but on the Low-pass filter , My Wave's level is low, not horizontal.
Following is my code.
function a = lowpass(x)
y=zeros(1,length(x));%y=zeros(1,2+length(x));
for n=13:length(x)
y(n) = 2*y(n - 1) - y(n - 2) + x(n)- 2*x(n- 6)+x(n- 12);
end
a=y;
plot(1:length(a),a);
end
My error picture is on here. http://www.flickr.com/photos/82814421@N08/sets/72157630617085494/ Album "MatLAB-question -02"
Top figure is original signal. Bottom figure is after the low-pass's signal.
Who can help me?

Answers (1)

Wayne King
Wayne King on 17 Jul 2012
It looks like you are just implementing this difference equation
A = [1 -2 1]; B = [1 0 0 0 0 -2 0 0 0 0 0 1];
y = filter(B,A,x);
where x is the input to the filter and y is the output. Why not just use the above?
Also, your filter is a lowpass filter, but it does not look like a particularly good one, for one thing, it isn't stable.
Is there any reason you have to use this lowpass filter?
That is a lowpass filter, but it's

Categories

Find more on Signal Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!