Está en la página 1de 7

clc

clear all
n = 0:500;
s1 = cos(2*pi*(50)*n*(1/500));
s2 = cos(2*pi*(100)*n*(1/500));
s3 = cos(2*pi*(125)*n*(1/500));
x = s1+s2+s3;
N=30;
num=(1/N)*ones(1,N);
y=filter(num,1,x);
clf
subplot(2,1,1)
stem(n, x,'r');
axis([0,25, -2, 4]);
subplot(2,1,2)
stem(n, y,'g');
axis([0,25, -2, 2]);

clc
clear all
n=0:99;
x=cos(pi*n);
y=zeros(1,100);
y(1)=x(1);
y(2)=x(2)-2*x(1);
for s=3:100
y(s)=x(s)-2*x(s-1)+x(s-2);
end
subplot(2,1,1)
stem(n, x,'r');
axis([0,25, -1, 1]);
subplot(2,1,2)
stem(n, y,'g');
axis([0,25, -5, 5]);

clc
clear all
n=0:99;
x=cos(pi*n);
y=filter([1 -2 1],1,x);
subplot(2,1,1)
stem(n, x,'r');
axis([0,25, -1, 1]);
subplot(2,1,2)
stem(n, y,'b');
axis([0,25, -5, 5]);
clc
clear all
x=[1 zeros(1,99)];
y(1)=-1;
y(2)=1;
for s=3:100,
y(s)=y(s-2);
end
stem(y,'b');
axis([0,25, -1, 1]);
clc
clear all
x=[1 zeros(1,99)];
y=filter(-1,[1 1],x);
stem(y);
axis([0,25, -1, 1]);
y=impz(-1,[1 1],25);
stem(y,'r');
clc
clear all
x=input('Ingrese una Seal a filtrar');
k=input('Ingrese Factor de ganancia (entre 0 y 1)');
D=input('Ingrese Retardo del eco (positivo y entero)');
y=filter(1,[1 zeros(1,D-1)-k],x)
subplot(2,1,1)
stem(x,'b');
subplot(2,1,2)
stem(y,'r');
clc
clear all
x=input('Ingrese Seal a filtrar');
k=input('Ingrese Factor de ganancia (entre 0 y 1)');
D=input('Ingrese Retardo del eco (positivo y entero)');
y=filter([1 zeros(1,D-1) k zeros(1,D-1) k^2],1,x)
subplot(2,1,1)
stem(x);
subplot(2,1,2)
stem(y);

También podría gustarte