Professional Documents
Culture Documents
%************************************************************************
% Ingeniera Electrnica
%************************************************************************
%************************************************************************
%MODULACION AM
%************************************************************************
%Punto (1)
%************************************************************************
%Modulacin en amplitud de un tono de prueba
Lmedio=1000;
%Mitad de la cantidad de muestras a r
ecolectar
fm=1000;
%Frecuencia de muestreo
treq=2*Lmedio/fm;
%Tiempo requerido para recolectar las
muestras
t=0:1/(fm-1):treq;
%Vector de muestras a recolectar
%Seal mensaje (tono):
fs=fm;
ftono=10;
wtono=2*pi*ftono;
mtono=1.6*cos(wtono*t);
%Frecuencia de muestreo
%Frecuencia de la seal a modular
%Frecuencia en rads/s
%Seal a modular
%Demodulacin (AM)
mreconst = demod(s,fc,fs,'am');
%************************************************************************
%Punto (2)
%************************************************************************
%Grfica de la seal tono de prueba
figure(1)
subplot(3,1,1);
plot(t,mtono);
title('Seal tono de prueba');
xlabel('Tiempo (segundos)');
ylabel('Amplitud');
txt=strcat('f muestreo =',num2str(fs),' Hz');
legend(txt);
grid on;
%Grfica de la seal modulada
subplot(3,1,2)
plot(t,s);
title('Seal modulada');
xlabel('Tiempo (segundos)');
ylabel('Amplitud');
txt=strcat('f muestreo =',num2str(fs),' Hz');
legend(txt);
axis([0 treq/4 -2 2]);
grid on;
%Grfica de la seal demodulada
subplot(3,1,3);
plot(t,mreconst);
title('Seal reconstruida');
xlabel('Tiempo (segundos)');
ylabel('Amplitud');
axis([0 treq -3 3]);
txt=strcat('f muestreo =',num2str(fs),' Hz');
legend(txt);
grid on;
%Clculo de la DFT utilzando la FFT
Nfft=1024;
Y=fft(s,Nfft);
Y2=fftshift(Y);
norm=max(abs(Y2));
Yf=unwrap(angle(Y2));
eal
%Vector de frecuencias
M=Nfft/2;
faux(M+1:Nfft)=0:M-1;
faux(1:M)=-M:-1;
f=fm*faux/(Nfft);
xlabel('Tiempo (segundos)');
ylabel('Amplitud');
axis([0 treq/4 -(ysmax+1) ysmax+1]);
grid on;
end
figure(5);
if i==1
subplot(4,1,1);
plot(t,yc);
title('Seal portadora');
xlabel('Tiempo (segundos)');
ylabel('Amplitud');
axis([0 treq/4 -Ap Ap]);
txtp=strcat('fc=',num2str(fyc));
legend(txtp);
grid on;
subplot(4,1,2);
plot(t,ym);
title('Seal a modular para obtener un ndice de modulacin m<1');
xlabel('Tiempo (segundos)');
ylabel('Amplitud');
txtp=strcat('Amplitud media=',num2str(Am1));
legend(txtp);
grid on;
end
if i==2
subplot(4,1,3);
plot(t,ym);
title('Seal a modular para obtener un ndice de modulacin m=1');
xlabel('Tiempo (segundos)');
ylabel('Amplitud');
txtp=strcat('Amplitud media=',num2str(Am1));
legend(txtp);
grid on;
end
if i==3
subplot(4,1,4);
plot(t,ym);
title('Seal a modular para obtener un ndice de modulacin m>1');
xlabel('Tiempo (segundos)');
ylabel('Amplitud');
txtp=strcat('Amplitud media=',num2str(Am1));
legend(txtp);
grid on;
end
end
%************************************************************************
%Punto (5)
%************************************************************************
%Modulacin de una seal con ruido utilzando las funciones "modulate" y
%"demod"
Lmedio=1000;
%Mitad de la cantidad de muestras a recolectar
fm=1000;
%Frecuencia de muestreo
treq=2*L_medio/fm;
%Tiempo requerido para recolectar las muestras
t=0:1/(fm-1):treq;
%Vector de muestras a recolectar
%Seal modulada (AM)
fc=100;
s=modulate(mtono,fc,fs,'am');
% Portadora
fc=50;
% Seal mensaje
fs=fm;
m=15*sin(10*pi*t)+10*sin(20*pi*t);
% Seal modulada
g=modulate(m,fc,fs,'am');
% Ruido
gruido=g+8*randn(1,length(g));
% Seal reconstruida
mreconst=demod(g,fc,fs,'am');
figure(6);
subplot(3,1,1);
plot(t,m);
title('Seal a modular');
xlabel('Tiempo (segundos)');
ylabel('Amplitud');
txtp=strcat('fmuestreo=',num2str(fm));
legend(txtp);
grid on;
subplot(3,1,2);
plot(t,g_ruido);
title('Seal modulada con ruido adherido en el canal de transmisin');
xlabel('Tiempo (segundos)');
ylabel('Amplitud');
txtp=strcat('fmuestreo=',num2str(fm));
legend(txtp);
grid on;
subplot(3,1,3);
plot(t,m_reconst,t,m);
title('Seal reconstruida o demodulada');
xlabel('Tiempo (segundos)');
ylabel('Amplitud');
legend('Seal demodulada o reconstruida','Seal original');
grid on;
%************************************************************************
Modulacin AM