Está en la página 1de 17

LABORATORIO DE PROCESAMIENTO DIGITAL DE SEÑALES EXPERIENCIA 7

UNIVERSIDAD NACIONAL MAYOR DE SAN MARCOS


(Universidad del Perú, DECANA DE AMÉRICA)

LABORATORIO PROCESAMIENTO DIGITAL


DE SEÑALES
“Transformada de Fourier”

Turno: Viernes de 6-8 p.m

Profesor: Edgard Oporto


APELLIDOS Y NOMBRES: CÓDIGO:

Mendoza Morales, Walter 16190096

Anco Llamocca, Carlos Felipe 16190153

2019
LABORATORIO DE PROCESAMIENTO DIGITAL DE SEÑALES EXPERIENCIA 7

UNIVERSIDAD NACIONAL MAYOR DE SAN MARCOS


FACULTAD DE INGENIERIA ELECTRONICA Y ELECTRICA

EXPERIENCIA 7
TRANSFORMADA DE FOURIER

I. OBJETIVOS
a) Analizar y comprobar las diversas propiedades y aplicaciones de la transformad de Foruier.

II. EQUIPOS Y MATERIALES


Computador con Matlab

III. MARCO TEORICO/INFORME PREVIO


.

Transformada de Fourier

La transformada de Fourier, denominada así por Joseph Fourier, es una transformación


matemática empleada para transformar señales entre el dominio del tiempo (o espacial) y
el dominio de la frecuencia, que tiene muchas aplicaciones en la física y la ingeniería. Es reversible,
siendo capaz de transformarse en cualquiera de los dominios al otro. El propio término se refiere
tanto a la operación de transformación como a la función que produce.
En el caso de una función periódica en el tiempo (por ejemplo, un sonido musical continuo pero no
necesariamente sinusoidal), la transformada de Fourier se puede simplificar para el cálculo de un
conjunto discreto de amplitudes complejas, llamado coeficientes de las series de Fourier. Ellos
representan el espectro de frecuencia de la señal del dominio-tiempo original.

La transformada de Fourier así definida goza de una serie de propiedades de continuidad que
garantizan que puede extenderse a espacios de funciones mayores e incluso a espacios
de funciones generalizadas.
Sus aplicaciones son muchas, en áreas de la ciencia e ingeniería como la física, la teoría de los
números, la combinatoria, el procesamiento de señales (electrónica), la teoría de la probabilidad,
la estadística, la óptica, la propagación de ondas y otras áreas. En procesamiento de señales la
transformada de Fourier suele considerarse como la descomposición de una señal en componentes
de frecuencias diferentes, es decir, corresponde al espectro de frecuencias de la señal .

Definición formal
LABORATORIO DE PROCESAMIENTO DIGITAL DE SEÑALES EXPERIENCIA 7

Propiedades básicas

VI. PROCEDIMIENTO

DTFT
1. Analice el siguiente código y obtenga la transformada de Fourier de las tres señales.

%DTFT de señales NO PERIODICAS (PULSO ,SINUSOIDE VENTANA,CHIRP)


clear all; clf
%Longitud de la señal (incluyendo sus ceros)
L = 128;
%SEÑALES
OPCION = input('SELECCIONE: Pulso (1), Sinusoide ventana (2), Chirp (3)')
if OPCION == 1,
N = 21;
%GENERACION PULSO
x = [ones(1,N) zeros(1,L-N)];
elseif OPCION == 2,
N = 200;
n = 0:N-1;
%SINUSOIDE VENTANA
x = [cos(4*pi*n/N) zeros(1,L-N)];
else
n = 0:L-1;
%CHIRP
x = cos(pi*n.^2/(4*L));
end
% TRANSFORMADA DISCRETA DE FOURIER
X = fft(x,128);
w = 0:2*pi/L:2*pi-2*pi/L;
%Vector frecuencia
w1 = w-pi;
n = 0:length(x)-1;
figure(1)
%PLOT de la señal discreta en el dominio del tiempo-----------------------------------------------------------------
subplot(311)
stem(n,x);
axis([0 length(n)-1 1.1*min(x) 1.1*max(x)]); grid
xlabel('n'); ylabel('x[n]')
%PLOT del espectro de magnitud-------------------------- ----------------------------------------------------------------
-
subplot(312)
plot(w1, fftshift(abs(X)));
axis([min(w1) max(w1) 0 1.1*max(abs(X))])
xlabel('\omega (radians)'); ylabel('|X(e^{j\omega})|'); grid
%PLOT del espectro de fase-------------------------------------------------------------------------------------------------
LABORATORIO DE PROCESAMIENTO DIGITAL DE SEÑALES EXPERIENCIA 7

subplot(313)
plot(w1, fftshift(angle(X)))
axis([min(w1) max(w1) 1.1*min(angle(X)) 1.1*max(angle(X))])
xlabel('\omega (radians)'); ylabel('<X(e^{j\omega})'); grid

OPCION 1
LABORATORIO DE PROCESAMIENTO DIGITAL DE SEÑALES EXPERIENCIA 7

OPCION 2

OPCION 3
LABORATORIO DE PROCESAMIENTO DIGITAL DE SEÑALES EXPERIENCIA 7

2. Preguntas
Defina una función discreta y no periódica y responda/obtenga lo solicitado a continuación (DTFT).

a. Espectro de magnitud
b. Espectro de fase (expresado en grados, no radianes)
c. Densidad espectral de potencia
d. Finalidad de fftshift
e. Finalidad de angle

Fs = 1000; % frecuencia de muestreo


T = 1/Fs; % perido de muestreo
L = 1500; % longitud de la señal
t = (0:L-1)*T; % vector tiempo

S = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
X = S + 2*randn(size(t));
subplot(411)
plot(1000*t(1:50),X(1:50))
title('Señal en el dominio del tiempo')
xlabel('t (ms)')
ylabel('X(t)')

Y = fft(X);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
subplot(412)
plot(f,P1)
title('Espectro de frecuencia de X(t)')
xlabel('f (Hz)')
ylabel('|P1(f)|')

subplot(413)
angulo=angle(Y);
plot(angulo)
LABORATORIO DE PROCESAMIENTO DIGITAL DE SEÑALES EXPERIENCIA 7

axis([0 30 -5 5])
title('Espectro de fase ')

subplot(414)
PDS=Y.*conj(Y);
plot(PDS)
title('Densidad espectral de potencia')
axis([0 1500 0 500000])

3. – Analice y explique el código siguiente.

%Gráfica de señales en tiempo discreto y sus espectros


%define DT variable
n = 0:32;
%define DT signals
xfast = (-0.95).^n;
xslow = (0.95).^n;
%plot slow signal----------------------------------------------------------
subplot(2,2,1);
stem(n, xslow);
grid;
xlabel('n');
ylabel('x[n] = (0.95)^n');
title('Slow Varying DT Signal');

% plot fast signal---------------------------------------------------------


subplot(2,2,3);
stem(n, xfast);
grid;
xlabel('n');
ylabel('x[n] = (-0.95)^n');
title('Fast Varying DT Signal');
% define frequencies
W = -3*pi:0.01:3*pi;
LABORATORIO DE PROCESAMIENTO DIGITAL DE SEÑALES EXPERIENCIA 7

%DEFINICION TRANSFORMADA DISCRETA


Xfast = 1./(1+(0.95)*exp(-j*W));
Xslow = 1./(1-(0.95)*exp(-j*W));
% plot DTFT of slow signal
subplot(2,2,2);%-----------------------------------------------------------
plot(W, abs(Xslow));
grid;
xlabel('Discrete Frequency');
ylabel('|DTFT[(.95)^n]|');
title('Magnitude Spectrum of Slow Signal');
% plot DTFT of fast signal-------------------------------------------------
subplot(2,2,4);
plot(W, abs(Xfast));
grid;
xlabel('Discrete Frequency');
ylabel('|DTFT[(-.95)^n]|');
title('Magnitude Spectrum of Fast Signal');

4. – Obtenga los mismos resultados empleando la función fft de Matlab

t=0:32;
x=(-0.95).^t;
W = -3*pi:0.01:3*pi;
y=fft(x,1885);
magnitud=abs(y);
plot(W,magnitud,'k');
axis([-20 20 0 20])
xlabel('frecuencia w [rad/seg]');
ylabel('Magnitud');
title('Espectro de x[n]=(-0.95)^n')
LABORATORIO DE PROCESAMIENTO DIGITAL DE SEÑALES EXPERIENCIA 7

t=0:32;
x=(0.95).^t;
W = -3*pi:0.01:3*pi;
y=fft(x,1885);
magnitud=abs(y);
plot(W,magnitud);
axis([-20 20 0 20])
xlabel('frecuencia w [rad/seg]');
ylabel('Magnitud');
title('Espectro de x[n]=(0.95)^n')

5. El siguiente código obtiene la DTFT de una señal y muestra su


espectro con el eje horizontal en Hz
LABORATORIO DE PROCESAMIENTO DIGITAL DE SEÑALES EXPERIENCIA 7
LABORATORIO DE PROCESAMIENTO DIGITAL DE SEÑALES EXPERIENCIA 7

%parte 5
Puntos =200;
%Vector tiempo
t=0:1/Puntos:10-1/Puntos;
%señal
x=sin(2*pi*15*t)+sin(2*pi*40*t);
%trasformada discreta de Fourier
y=fft(x);
m=abs(y);
y(m<1e-6)=0;
%DETERMINANDO FASE
p=unwrap(angle(y));
f=(0:length(y)-1)*Puntos/length(y);
%GRAFICO DE MAGNITUD DE LA TRANSFORMADA
subplot(2,1,1)
plot(f-100,fftshift(m))
title('MAGNITUD')
%GRAFICO DE FASE DE LA TRANSFORMDA
subplot(212)
plot(f-100,fftshift(p*180/pi))
title('FASE')

Pregunta
Cuál es la máxima frecuencia qué pueden tener las componentes senoidales de la señal x. Sustente.

6. – El siguiente código muestra el espectro de una señal seno.


Analice, comente cada línea y sustente por qué no se muestra correctamente su espectro de
amplitud.
LABORATORIO DE PROCESAMIENTO DIGITAL DE SEÑALES EXPERIENCIA 7

%PARTE 6
fs=450;
t=0:1/fs:1;
f=250;
x=sin(2*pi*t*f);
nfft=4996;

X=fft(x,nfft);
X=X(1:nfft/2);
mx=abs(X);
ff=(0:nfft/2-1)*fs/nfft;

subplot(211)
stem(t,x)
title('ONDA SENO')
xlabel('TIEMPO(s)')
ylabel('AMPLITUD')

subplot(212)
plot(ff,mx)
title('ESPECTRO DE POTENCIA DE LA ONDA SENO ')
xlabel('FRECUENCIA (Hz)')
ylabel('POTENCIA')
LABORATORIO DE PROCESAMIENTO DIGITAL DE SEÑALES EXPERIENCIA 7

%PARTE 6
fs=450;
t=0:fs:100*fs;
f=250;
x=sin(2*pi*t*f);
nfft=4996;

X=fft(x,nfft);
X=X(1:nfft/2);
mx=abs(X);
ff=(0:nfft/2-1)*fs/nfft;

subplot(211)
stem(t,x)
title('ONDA SENO')
xlabel('TIEMPO(s)')
ylabel('AMPLITUD')

subplot(212)
plot(ff,mx)
title('ESPECTRO DE POTENCIA DE LA ONDA SENO ')
xlabel('FRECUENCIA (Hz)')
ylabel('POTENCIA')
LABORATORIO DE PROCESAMIENTO DIGITAL DE SEÑALES EXPERIENCIA 7

7. – Obtenga los espectros DTFT de las siguientes señales.


a. Audio de corta duración
b. Pulso gaussiano
c. Pulso cuadrado
d. Onda cuadrada
e. Impulso unitario

%PARTE 7
%PULSO GAUSSIANO
%FRECUENCIA DE MUESTREO
Fs = 100;
%VECTOR TIEMPO
t = -0.5:1/Fs:0.5;
%LONGITUD DE LA SEÑAL
L = length(t);
%PULSO GAUSSIANO
X = 1/(4*sqrt(2*pi*0.01))*(exp(-t.^2/(2*0.01)));
subplot(211)
plot(t,X)
title('PULSO GAUSSIANO EN EL DOMINIO DEL TIEMPO')
xlabel('TIEMPO(s)')
ylabel('X(t)')

n = 2^nextpow2(L);
Y = fft(X,n);
f = Fs*(0:(n/2))/n;
P = abs(Y/n);
subplot(212)
plot(f,P(1:n/2+1))
title('PULSO GAUSSIANO EN EL DOMINIO DE LA FRECUENCIA')
xlabel('FRECUENCIA Hz')
ylabel('|P(f)|')
LABORATORIO DE PROCESAMIENTO DIGITAL DE SEÑALES EXPERIENCIA 7

%PARTE 7 PULSO CUADRADO


%DEFINICION DE VARIABLE SIMBOLICA
syms a t;
%DEFINICION DE LA FUNCION
ft=heaviside(t+0.5)-heaviside(t-0.5);
Fw=fourier(ft);
Fw=simplify(Fw)

ft=subs(ft,a,1);
%GRAFICO DEL PULSO RECTANGULAR EN EL DOMINIO DEL TIEMPO
subplot(2,1,1)
ezplot(ft,[-2,2]);
ylim([-0.2 1.2])
xlabel('t');
ylabel('f(t)')
title('PULSO RECTANGULAR')

Fw=subs(Fw,a,1);
%GRAFICO DEL PULSO RECTANGULAR EN EL DOMINIO DE LA FRECUENCIA
subplot(2,1,2)
hg=ezplot(Fw,[-10,10]);
set(hg)
ylim([-1 2.2])
xlabel('\omega');
ylabel('F(\omega)')
title('TRANSFORMADA DE FOURIER ')
grid on
LABORATORIO DE PROCESAMIENTO DIGITAL DE SEÑALES EXPERIENCIA 7

%PARTE7_ONDA CUADRADA PERIODICA

close all
t=-10:0.01:10;
duty=50;
% porcentaje del periodo en el que la señal es positiva
f_cuadrada=square(2*pi*0.5*t,duty);
%TRANSFORMADA DE FOURIER
y=fft(f_cuadrada);
ymag=abs(y);

subplot(211)
plot(t,f_cuadrada);
axis([0 10 0 1.5])
title('ONDA CUADRADA PERIODICA')

subplot(212)
plot(ymag)
axis([-200 2200 0 1800])
title('TRANFORMADA DE FOURIER ')

%PARTE7_IMPULSO UNITARIO
close all
t = (-1:0.01:1)';
impulse = t==0;
y=fft(impulse);
ymag=abs(y);

subplot(211)
LABORATORIO DE PROCESAMIENTO DIGITAL DE SEÑALES EXPERIENCIA 7

plot(t,[impulse])
title('IMPULSO EN EL DOMINIO DEL TIEMPO ')

subplot(212)
plot(ymag)
title('IMPULSO EN EL DOMINIO DE LA FRECUENCIA ')

También podría gustarte