pds9_3
🧩 Syntax:
clear variables;
M = 10;
h = (1/M)*ones(1, M);
[H, w] = freqz(h, 1, 2^10);
%a
figure, stem(0:length(h)-1,h);
%b
figure,
subplot(2,1,1); plot(w/pi, abs(H));
subplot(2,1,2); plot(w/pi, angle(H));
%c
f=1/10;
n=0:99;
x=sin(2*pi*f*n);
h1=filter(h,1,x);
figure,
subplot(2,1,1);stem(n,x);
subplot(2,1,2); stem(n,h1);
noise = x+rand(1, length(h1));
noisef = filter(h, 1, noise);
figure,
subplot(2,1,1); stem(n, noise);
subplot(2,1,2); stem(n, noisef);