File:Gate sequence discrete-time low-pass filter frequency output comparison.pdf

Description
English: Comparison among frequency outputs of discrete-time low-pass filters , and , where with , with gate sequence as the input.
Italiano: Confronto tra le uscite in frequenza dei filtri passa-basso a tempo discreto , e , dove con , con la sequenza porta all'ingresso.
Date
Source Own work
Author Luca Ghio
Permission
(Reusing this file)
Public domain I, the copyright holder of this work, release this work into the public domain. This applies worldwide.
In some countries this may not be legally possible; if so:
I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.
Category:Self-published work#Gate%20sequence%20discrete-time%20low-pass%20filter%20frequency%20output%20comparison.pdfCategory:PD-self#Gate%20sequence%20discrete-time%20low-pass%20filter%20frequency%20output%20comparison.pdf
gnuplot source
InfoField
click to expand
N=11;
n=[0:N-1];
x=ones(1,N);
r1=0.8;
r2=0.5;
r3=0.2;
h1=r1.^n;
h2=r2.^n;
h3=r3.^n;
figure
set (gca,'FontSize',14)
stem(n,x)
xlabel('n')
ylabel('x(n)')
axis([0 10 0 2])
grid on
figure
set (gca,'FontSize',14)
stem(n,h1)
xlabel('n')
ylabel('h_1(n)')
axis([0 10 0 1])
grid on
figure
set (gca,'FontSize',14)
stem(n,h2)
xlabel('n')
ylabel('h_2(n)')
axis([0 10 0 1])
grid on
figure
set (gca,'FontSize',14)
stem(n,h3)
xlabel('n')
ylabel('h_3(n)')
axis([0 10 0 1])
grid on

N=11;
n=[0:N-1];
x=ones(1,N);
r1=0.8;
r2=0.5;
r3=0.2;
k1=(1-r1)/(1-r1^N);
k2=(1-r2)/(1-r2^N);
k3=(1-r3)/(1-r3^N);
h1=k1*r1.^n;
h2=k2*r2.^n;
h3=k3*r3.^n;
%  figure
%  set (gca,'FontSize',14)
%  stem(n,x)
%  xlabel('n')
%  ylabel('x(n)')
%  axis([0 10 0 2])
%  grid on
%  figure
%  set (gca,'FontSize',14)
%  stem(n,h1)
%  xlabel('n')
%  ylabel('h_1(n)')
%  axis([0 10 0 1])
%  grid on
%  figure
%  set (gca,'FontSize',14)
%  stem(n,h2)
%  xlabel('n')
%  ylabel('h_2(n)')
%  axis([0 10 0 1])
%  grid on
%  figure
%  set (gca,'FontSize',14)
%  stem(n,h3)
%  xlabel('n')
%  ylabel('h_3(n)')
%  axis([0 10 0 1])
%  grid on

f=linspace(-0.5,0.5,1000);
H1=k1*(1-(r1*exp(-j*2*pi*f)).^N)./(1-r1*exp(-j*2*pi*f));
H2=k2*(1-(r2*exp(-j*2*pi*f)).^N)./(1-r2*exp(-j*2*pi*f));
H3=k3*(1-(r3*exp(-j*2*pi*f)).^N)./(1-r3*exp(-j*2*pi*f));
figure
set (gca,'FontSize',14)
plot(f,abs(H1))
hold on
plot(f,abs(H2),'r')
plot(f,abs(H3),'g')
xlabel('f')
ylabel('|H_i(e^{j\omega})|')
axis([-0.5 0.5 0 1.5])
grid on
legend('|H_1(e^{j\omega})|','|H_2(e^{j\omega})|', '|H_3(e^{j\omega})|')

N = 11;
X = (sin(pi*f*N) ./ sin(pi*f)) .* exp(-j*pi*f*(N-1));
figure
set (gca,'FontSize',14)
plot(f,abs(X))
xlabel('f')
ylabel('|X(e^{j\omega})|')
axis([-0.5 0.5 0 11])
grid on

Y1 = X .* H1;
Y2 = X .* H2;
Y3 = X .* H3;
figure
set (gca,'FontSize',14)
plot(f,abs(Y1))
hold on
plot(f,abs(Y2), 'r')
plot(f,abs(Y3), 'g')
xlabel('f')
ylabel('|Y_i(e^{j\omega})|')
axis([-0.5 0.5 0 11])
grid on
legend('|Y_1(e^{j\omega})|','|Y_2(e^{j\omega})|', '|Y_3(e^{j\omega})|')

N=11;
n=[0:N-1];
x=ones(1,N);
r1=0.8;
r2=0.5;
r3=0.2;
k1=(1-r1)/(1-r1^N);
k2=(1-r2)/(1-r2^N);
k3=(1-r3)/(1-r3^N);
h1=k1*r1.^n;
h2=k2*r2.^n;
h3=k3*r3.^n;
y1=conv(x,h1);
y2=conv(x,h2);
y3=conv(x,h3);
n=[0:length(y1)-1];
figure
set (gca,'FontSize',14)
stem(n,y1)
xlabel('n')
ylabel('y_1(n)')
axis([0 20 0 1.5])
grid on
figure
set (gca,'FontSize',14)
stem(n,y2)
xlabel('n')
ylabel('y_2(n)')
axis([0 20 0 1.5])
grid on
figure
set (gca,'FontSize',14)
stem(n,y3)
xlabel('n')
ylabel('y_3(n)')
axis([0 20 0 1.5])
grid on
Category:Images with Octave source code Category:Created with GNU Octave Category:DFT vs DCT
Category:Created with GNU Octave Category:DFT vs DCT Category:Images with Octave source code Category:PD-self Category:Pages using deprecated source tags Category:Self-published work