0% found this document useful (0 votes)
16 views

%modulacion Y Demodulacion Am

This document contains Matlab scripts for amplitude modulation (AM) and demodulation. It defines the carrier frequency, modulating frequency and modulation index. It generates the carrier signal, modulating signal and amplitude modulated signal. It then performs the demodulation and applies a bandpass filter to recover the original signal.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

%modulacion Y Demodulacion Am

This document contains Matlab scripts for amplitude modulation (AM) and demodulation. It defines the carrier frequency, modulating frequency and modulation index. It generates the carrier signal, modulating signal and amplitude modulated signal. It then performs the demodulation and applies a bandpass filter to recover the original signal.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%ScriptdematlabAM.

1
clc
clearall
fc=1e2;%fdeportadora
fm=.1e2;%fdemoduladora
mu=1.5%FactordeMod
Ac=1;
t=[0:1e4:.4];%Basedetiempos
s_c=cos(2*pi*fc*t);%Portadora
s_i=cos(2*pi*fm*t);%Moduladora
a_am=Ac*(1+mu.*s_i).*s_c;%AM
plot(t,a_am,'r')
figure,plot(t,s_i,'b')
figure,plot(t,s_c,'g')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%ScriptmatlabAM2
%MODULACIONYDEMODULACIONAM

%PROGRAMAPARAREALIZARLAMODULACIONYDEMODULACIONDEUNASENAL

closeall

clearall

fm=input('Introduzcafrecuenciademuestreo:');

fs=input('Introduzcafrecuenciadelaseal:');

fc=input('Introduzcafrecuenciadelasealportadora:');

%MODULACION

t=0:1/fm:5;%definiendoeltiemporeal

L=length(t);%sacandolalongituddelvectortiempo


f1=sin(2*pi*fs*t);%senaldeinformacion

subplot(2,2,1);plot(t(1:500),f1(1:500),'r');title('senaldeentrada'),gridon,xlabel('tiempo'),ylabel('m(t)')

f2=cos(2*pi*fc*t);%creandocosenoidalparalograrlamodulacion

subplot(2,2,2);plot(t(1:100),f2(1:100));title('sealportadora'),gridon,xlabel('tiempo'),ylabel('p(t)')

f3=f1.*f2;%multiplicaciondelasdosfunciones

subplot(2,2,3:4);plot(t(1:500),f3(1:500));title('sealmodulada'),gridon,xlabel('tiempo'),ylabel('m(t)*p(t)')

holdon

plot(t(1:500),f1(1:500),'r')

pause

g1=abs(fftshift(fft(f1)))/L;%transformandoenfrecuenciaf1

k=[(L/2)+1:L/2];

k1=(1/(0.795*2*pi))*k;

figure

subplot(3,1,1),plot(k1,g1),title('espectrodemagnituddelasenaldeentrada'),gridon,xlabel('frecuencia'),ylabel('m(f)')

g2=abs(fftshift(fft(f2)))/L;%transformandoenfrecuanciaf2

subplot(3,1,2);plot(k1,g2),title('espectrodemagnituddelasenalportadora'),gridon,xlabel('frecuencia'),ylabel('p(f)')

g3=abs(fftshift(fft(f3)))/L;%transformandoenfrecuenciaf3


subplot(3,1,3);plot(k1,g3),title('espectrodemagnituddelasenalmodulada'),gridon,xlabel('frecuencia'),ylabel('m(f)convp(f)')

pause

%DEMODULACION

%asumiendoceroperdidasenelmedio

f4=f3.*f2;%demodulando

figure%figura3

subplot(2,2,1:2);plot(t(1:500),f4(1:500)),title('senaldemodulada'),gridon,xlabel('tiempo'),ylabel('R(t)')

g4=abs(fftshift(fft(f4)))/L;%transformandoenfrecuencialasenaldemodulada

subplot(2,2,3:4);plot(k1,g4),title('espectrodemagnituddelasenaldemodulada'),gridon,xlabel('frecuencia'),ylabel('R(f)=m(f)convp(f)')

pause

%FILTRO

[b,a]=butter(15,3*fs/(fc/2));%segeneranlosparametrosdelfiltro

Fx=filtfilt(b,a,f4);%creandoelfiltropasabanda

[H,W]=freqz(b,a,15);

figure

plot(abs(H),'r'),gridon,xlabel('frecuencia'),ylabel('magnitud'),title('filtro');%graficandoelfiltro

pause


figure

plot(t(1:1000),Fx(1:1000)),title('comparacionentrelasenalfiltradayoriginal{m(t)}'),gridon,xlabel('tiempo'),ylabel('amplitud')

holdon

plot(t(1:1000),f1(1:1000),'r'),legend('senalfiltrada','senaloriginal')%segraficanlasenaloriginalylasenalrecuperda

%sehamoduladoydemoduladounasenal

You might also like