Artefacts when filtering a contiguous signal
Show older comments
Hello,
I have a signal vector vec (54 sampling points). That looks like that:
vec = [5 8 10 8 5 3 1 3 5];
vec = [vec vec vec vec vec vec];

When I filter it with a lowpassfilter, it looks like that (Fig1):

Code for the filtering is:
h = fdesign.lowpass('fp,fst,ap,ast', 0.10, 1, 1, 60);
Hd = design(h, 'equiripple');
c = filter(Hd,vec);
plot(c);
Now, I want to split the sample in zwo sections and filter them separately. As a result, I want to get the same result as in Fig1.
I tried this code:
% design filter
h = fdesign.lowpass('fp,fst,ap,ast', 0.10, 1, 1, 60);
Hd = design(h, 'equiripple');
% split signal in two sections
vec1 = vec(1:27);
vec2 = vec(28:54);
% define numerator, denominator and initial conditions for filter delay
num = Hd.Numerator;
den = 1;
zi = vec1(end-2:end);
% filter the two sections
c1 = filter(num,den,vec1);
c2 = filter(num,den,vec2,zi);
% concatenate and plot the filtered sections
c = [c1 c2];
plot(c);
but get artefacts in the plot:

Could someone tell me what am I doing wrong?
Best regards,
Rocketman
Accepted Answer
More Answers (0)
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!