Professional Documents
Culture Documents
Function y
Function y
>> n-0:15;
>> fo=400
fo =
400
>> fo=400;
>> n-0:15;
>>
>> n-0:15;
>> n=0:15;
>> Xn=exp(j*n/3);
>> Xk=fft(Xn)
Xk =
Columns 1 through 2
Columns 3 through 4
Columns 5 through 6
Columns 7 through 8
Columns 9 through 10
Columns 11 through 12
Columns 13 through 14
Columns 15 through 16
-0.4405 + 0.7407i -0.8615 + 0.9571i
>> k=n;
>> subplot(221)
>> stem(k,real(Xk));
>> subplot(223)
>> Xn=ifft(Xk);
>> subplot(222)
>> subplot(224)
>> stem(n,imag(Xn));
>>
CONBOLUCION
clc
clear
pause on
x=[0 1 2 3 4 3 2 1 0]; %Respuesta al impulso unitario
h=[1 1 1 1 1 1 1 1 ]; %Señal de entrada
m=length(x);
n=length(h);
%invierte el vector h
hi=fliplr(h);
k=20;
X=[x,zeros(1,40-m)];
X= X([ end-k+1:end 1:end-k ]);
H=[h,zeros(1,40-n)];
H= H([ end-k+1:end 1:end-k ]);
xn=-20:20-1;
Y=zeros(1,40);
p=zeros(1,40);
h1=subplot(3,1,1);
plot(xn,X,'-g')
ylabel('h(t)')
title('Respuesta al impulso unitario')
% colocar(h1,'YLim',[a b])
h2=subplot(3,1,2);
plot(xn,H,'-y')
% colocar(h2,'YLim',[a b])
pause(3)
h2=subplot(3,1,3);
plot(xn,Y,'-m')
%ciclo
Hi=[hi,zeros(1,40-n)];
for i=1:40-n
p=X.*Hi;
Y(i+n-1)=sum(p);
subplot(3,1,2);
plot(xn,Hi,'-r')
ylabel('x(t)')
title('Señal de entrada')
subplot(3,1,3)
plot(xn,Y,'-m')
xlabel('Tiempo [s]')
ylabel('y(t)')
title('Señal de salida')
Hi= Hi([ end 1:end-1 ]);
pause(0.5)
end
pause off
salida=Y(abs(Y)>0);
salida2=conv(x,h);
[salida',salida2']