Documentos de Académico
Documentos de Profesional
Documentos de Cultura
ModuladorAM SIM.m
ModuladorAM SIM.m
fs=44100;
dt=1/fs; N=65536;
D=dt*N;
t=0:dt:D-dt; t=t';
%% Modulaci�n
q=mt.*osc1;
i=mt.*osc2;
s=i+q;
figure(1);
p1=plot(t, s,'-g');zoom;
hold on;
p2=plot(t,mt,'-b','LineWidth',2);zoom;
grid on
xlabel('Tiempo (t)');ylabel('V');
title('s(t)=Am(t)�B[cos(w_c�t)+sin(w_c�t)]');
legend ('Modulac AM-DSBSC(t)','Mensaje Original(t)','location','SE');
axis([0 4/fm min(s)-0.1 max(s)+0.1]);
hold off
print -depsc -r500 001Se�alOriginalyModulada
figure(2);
p3=plot(t, i,'-k','LineWidth',1);zoom;
hold on;
p4=plot(t, q,'-b','LineWidth',1);zoom;
grid on
xlabel('Tiempo (t)');ylabel('V');
title('i(t)=Am(t)�B[sin(w_c�t)], q(t)=Am(t)�B[cos(w_c�t)]');
legend ('i(t)-modulador','q(t)-modulador','location','SE')
axis([0 4/fm min(s)-0.1 max(s)+0.1])
hold off
print -depsc -r500 002IyQvst
%--------------------------------------------------------------------------
% An�lisis Espectral Parte 1
Mf=fft(mt);
S=fft(s);
%Reordenar mensaje
M=N/2;
Mf_aux=Mf;
Mf(M+1:N)=Mf_aux(1:M);
Mf(1:M)=Mf_aux(M+1:N);
Mfmag=abs(Mf)/N;
MfFase=unwrap(angle(Mf))*180/pi;
%Reordenar modulada
S_aux=S;
S(M+1:N)=S_aux(1:M);
S(1:M)=S_aux(M+1:N);
Smag=abs(S)/N;
Sfase=unwrap(angle(S))*180/pi;
figure(3);
p5=plot(f,Mfmag,'-b','LineWidth',1);zoom;
hold on;
p6=plot(f,Smag,'-g','LineWidth',1);zoom;
grid on
xlabel('Frecuencia (f)');ylabel('V');
title('Espectro del Mensaje y Se�al Modulada');
legend ('Magnit. Mensaje(f)','Magnit. AM-DSBSC(f)','location','NE')
axis([-3/2*fc 3/2*fc 0 max(Smag)+0.2])
hold off
print -depsc -r500 003EspectroOriginalyModulada
%Demodulaci�n
i2=s.*osc1;
q2=s.*osc2;
s2=i2+q2;
figure(4);
p7=plot(t,s2,'-g');zoom;
hold on;
p8=plot(t,mt,'-b','LineWidth',2);zoom;
grid on
xlabel('Tiempo (t)');ylabel('V');
title('s2(t)=s(t)�B[cos(w_c�t)+sin(w_c�t)]');
legend ('Se�al demod(t) - Sin filtro','Mensaje Original(t)','location','SE');
axis([0 4/fm min(s)-0.1 max(s)+0.1]);
hold off
print -depsc -r500 004Se�alOrigyDemodSinFiltro
S2=fft(s2);
S2_aux=S2;
S2(M+1:N)=S2_aux(1:M);
S2(1:M)=S2_aux(M+1:N);
S2mag=abs(S2)/N;
S2fase=unwrap(angle(S2))*180/pi;
faux(M+1:N)=0:M-1;
faux(1:M)=-M:-1;
f=faux/D; f=f';
figure(5);
p9=plot(f,S2mag,'-k','LineWidth',1);zoom;
hold on;
p10=plot(f,Smag,'-b','LineWidth',1);zoom;
grid on
xlabel('Frecuencia (f)');ylabel('V');
title('Espectro de Se�al Modulada y Se�al Demodulada sin Filtrar');
legend ('Magnit. Se�al Demod sin Filtro','Magnit. AM-DSBSC (f)','location','NE')
axis([-3/2*fc 3/2*fc 0 max(Smag)+0.2])
hold off
print -depsc -r500 005EspectroMod&DemodSinFiltro
%% parte 2.2, Filtro paso bajo dos polos para se�al demodulada
%Se compara la se�al demodulada sin filtrar con la filtrada (paso bajo)
figure(8)
p16=plot(f,S2mag,'-k','LineWidth',1);zoom;
hold on;
p17=plot(f,Ymag,'-b','LineWidth',1);zoom;
grid on
xlabel('Frecuencia (f)');ylabel('V');
zz=sprintf('Espectro de Se�al Demodulada filtrada, Fcorte=%2.1f KHz',Fc/1000);
title(zz);
legend ('Magnit. AM-DSBSC (f)','Magnit. Mensaje Recuperado(f)','location','NE')
hold off
print -depsc -r500 008EspectroSe�alReconstruida
Y_aux=Y;
Y(M+1:N)=Y_aux(1:M);
Y(1:M)=Y_aux(M+1:N);
faux(M+1:N)=0:M-1;
faux(1:M)=-M:-1;
f=faux/D;
y=ifft(Y);
y=real(y);
figure(9);
p18=plot(t,y,'-g');zoom;
hold on;
p19=plot(t,mt,'-b','LineWidth',2);zoom;
grid on
xlabel('Tiempo (t)');ylabel('V');
title('y(t) \cong m(t)');
legend ('Se�al Recuperada=y(t)','Mensaje Original=m(t)','location','SE');
if max(mt)>max(y)
mayor=max(mt);
menor=min(mt);
else
mayor=max(y);
menor=min(y);
end