clc close all clear all %Ejercicio 1 n = -10:20; x = heaviside(n-5)-heaviside(n+6); X = fft(x); stem(n,x), axis([-10 20 -2 2]) figure, plot(abs(X)) %Ejercicio 2 a = 1; % a > 0 xa = exp(-a*n).*heaviside(n); subplot(1,2,1), stem(n,xa) Xa = fft(xa); subplot(1,2,2), plot(abs(Xa)), title('exp(-a*n)*u[n]') %%%%%%%%%%%%%%%%%%%%%%%%% xb = (0.5).^(n-1).*heaviside(n-1); figure,subplot(1,2,1), stem(n,xb) Xb = fft(xb); subplot(1,2,2), plot(abs(Xb)), title('0,5^(n-1)*u[n-1]') %Ejercicio 3 figure, subplot(3,2,1), plot(real(X)) subplot(3,2,2), plot(imag(X)) subplot(3,2,3), plot(real(Xa)) subplot(3,2,4), plot(imag(Xa)) subplot(3,2,5), plot(real(Xb)) subplot(3,2,6), plot(imag(Xb)) figure, subplot(3,2,1), plot(abs(X)) subplot(3,2,2), plot(angle(X)) subplot(3,2,3), plot(abs(Xa)) subplot(3,2,4), plot(angle(Xa)) subplot(3,2,5), plot(abs(Xb)) subplot(3,2,6), plot(angle(Xb))