Signal go down in low pass filter

1 view (last 30 days)
I am designing a filter to implement in a microcontroller and testing the filter in Matlab. Filter transfer function is this: .
the differance equation is : .
I designed the filter like this
load('118e12m.mat');
figure(1);
plot(val);
%%
y1 = zeros(1,size(val,2));
for i = 13 : size(val,2)
y1(i) = 2*y1(i-1) - y1(i-2) + val(i) - 2*val(i-6) + val(i-12);
end
figure(2)
plot(y1)
My inpput signal looks like this:
My output is look like this:
I want to know is there a way to avoid this signal going down

Answers (1)

Image Analyst
Image Analyst on 16 Oct 2020
Unfortunately you delayed a solution because you bloew by the posting guidelines and forgot to attach '118e12m.mat'.
However, you can still read them here and then after that probably someone will answer.
It's probably because you're doing your filtering recursively, using the new prior y instead of the original prior y. Try calling your output array y2 instead of y1.

Community Treasure Hunt

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

Start Hunting!