Está en la página 1de 11

Instituto Politécnico Nacional

Unidad Profesional Interdisciplinaria en


Ingeniería y Tecnologías Avanzadas.

“Práctica 3: Transformada de Fourier”

Integrantes:

- González Padilla Roberto


- Reyes Varela Ricardo
- Rojas Gómez Enrique

2TM2

Señales y Sistemas

Rosas Flores José Alfredo

2014 – 2015.

1- Código:
clear all;
dw=1e-3;
w=-10:dw:10;
dt=1e-3;
t=-10:dt:10;
ft=10*exp(-5*abs(t));
u=0;
for o=-10:dw:10
u=u+1;
end
Fw=zeros(1,u);
n=1;
for p=-10:dw:10
Fwl=trapz(t,exp(-1i*p.*t).*ft);
Fw(n)=double(abs(Fwl));
n=n+1;
end
subplot(2,2,1)
plot(w,abs(Fw))
xlabel('Espectro-magnitud(numerico)');
ylim([0 5]);
grid on;
w=-10:dw:10;
Fw1=100./(25+w.^2);
subplot(2,2,2)
plot(w,abs(Fw1))
xlabel('Espectro-magnitud(teorico)');
ylim([0 5]);
grid on;
subplot(2,2,3)
plot(w,angle(Fw))
xlabel('Espectro-fase');
grid on;
subplot(2,2,4)
plot(w,angle(Fw1))
xlabel('Espectro-fase');
grid on;

Gráfica:

Ejercicio 2:
clear all;
A=load('sign.dat');
nota=audioread('nota.wav');
[n fn]=audioread('nota.wav');
subplot(2,2,[1 2]);
plot(n);
sound(n,fn)
Fn=fn;
Ln=length(n)/2
l=2^nextpow2(Ln);
Yn=fft(n,l)/Ln;
f_n=Fn/2*linspace(0,1,l/2+1);
subplot(2,2,[3 4]);
plot(f_n,2*abs(Yn(1:l/2+1)))
xlim([200 1000])

Código: Tecla 1

[y1 f1]=audioread('tecla_A1.wav');
subplot(2,2,[1 2]);
plot(y1);
sound(y1,f1)
F1=f1;
L1=length(y1)/2
l=2^nextpow2(L1);
Y=fft(y1,l)/L1;
f_1=F1/2*linspace(0,1,l/2+1);
subplot(2,2,[3 4]);
plot(f_1,2*abs(Y(1:l/2+1)))
xlim([500 1800])
Código: Tecla 2

[y2 f2]=audioread('tecla_A2.wav');
figure(2)
subplot(2,2,[1 2]);
plot(y2);
sound(y2,f2)
F2=f2;
L2=length(y2)/2
l=2^nextpow2(L2);
Y2=fft(y2,l)/L2;
f_2=F2/2*linspace(0,1,l/2+1);
subplot(2,2,[3 4]);
plot(f_2,2*abs(Y2(1:l/2+1)))
xlim([500 1500])

Código: Tecla 3
[y3 f3]=audioread('tecla_A3.wav');
figure(3)
subplot(2,2,[1 2]);
plot(y3);
sound(y3,f3)
F3=f3;
L3=length(y3)/2
l=2^nextpow2(L3);
Y3=fft(y3,l)/L3;
f_3=F3/2*linspace(0,1,l/2+1);
subplot(2,2,[3 4]);
plot(f_3,2*abs(Y3(1:l/2+1)))
xlim([500 2000])

tecla 3

Código: Tecla 4
[y4 f4]=audioread('tecla_A4.wav');
figure(4)
subplot(2,2,[1 2]);
plot(y4);
sound(y4,f4)
F4=f4;
L4=length(y4)/2
l=2^nextpow2(L4);
Y4=fft(y4,l)/L4;
f_4=F4/2*linspace(0,1,l/2+1);
subplot(2,2,[3 4]);
plot(f_4,2*abs(Y4(1:l/2+1)))
xlim([500 1800])

tecla 9

Código: Tecla 5
[y f5]=audioread('tecla_A5.wav');
figure(5)
subplot(2,2,[1 2]);
plot(y);
sound(y,f5)
F5=f5;
L5=length(y)/2
l=2^nextpow2(L5);
Y5=fft(y,l)/L5;
f_5=F5/2*linspace(0,1,l/2+1);
subplot(2,2,[3 4])
plot(f_5,2*abs(Y5(1:l/2+1)))
xlim([500 1400])
Ejercicio 3:

1.-Filtrar la señal mostrada en la Figura 12, mediante un filtro ideal tipo pasabajas con
frecuencia de corte igual a 20Hz.
Graficar la señal original y la señal filtrada. ¿El resultado corresponde con lo esperado
teóricamente?

El resultado si corresponde, ya que la señal se ve afectada de forma que se suaviza la señal


de entrada ya que solo se pasan las frecuencias menores a 20 Hz.
clear all;
lfile = load('sign.dat');
for m = 1:length(lfile)
t(m) = lfile(m,1);
ft(m) = lfile(m,2);
end
T = max(t)/length(ft);
Fs = 1/T;
subplot(2,1,1);
plot(t,ft)
xlabel('Señal Inicial')
xlim([0 1])
grid on
f=Fs*linspace(0,1,length(lfile));
Ft = fft(ft);
fil = Escalon(f)-Escalon(f-10);
FA = angle(Ft);
FM = abs(Ft);
FFA = FA.*fil;
FFM = FM.*fil;
FF=zeros(1,length(f));
for m=1:length(f)
FF(m)=FFM(m)*(cos(FFA(m))+1i*sin(FFA(m)));
end
iFF = ifft(FF);
subplot(2,1,2);
plot(t,iFF);
xlim([0 1])
xlabel('Aplicación de filtro')
grid on;
Señal Inicial

Aplicación de filtro

2. En el archivo sign.dat se tienen dos columnas, que representan el vector tiempo y los
valores de una señal. Extraer los datos, y filtrar la señal mediante un filtro ideal tipo
pasabajas con frecuencia de corte igual a 10Hz. Graficar la señal original y la señal filtrada,
pero debido a la gran cantidad de datos es posible que no sea clara la señal, escalar el eje
del tiempo usando xlim([0 1]).
clear all;
lfile = load('sign.dat');
for m = 1:length(lfile)
t(m) = lfile(m,1);
ft(m) = lfile(m,2);
end
Ts = max(t)/length(ft);
Fs = 1/Ts;
subplot(2,1,1);
plot(t,ft)
xlabel('Señal Inicial')
xlim([0 1])
grid on
f=Fs*linspace(0,1,length(lfile));
Ft = fft(ft);
fil = Escalon(f)-Escalon(f-10);
FtA = angle(Ft);
FtM = abs(Ft);
FtfA = FtA.*fil;
FtfM = FtM.*fil;
Ftf=zeros(1,length(f));
for m=1:length(f)
Ftf(m)=FtfM(m)*(cos(FtfA(m))+1i*sin(FtfA(m)));
end
iFtf = ifft(Ftf);
subplot(2,1,2);
plot(t,iFtf);
xlim([0 1])
xlabel('Aplicación de filtro')
grid on;

También podría gustarte