You are on page 1of 2

clc;

clear all;
close all;

wc=20;
wm=1;
t=0:0.01:2*pi;
A=1;
mf=input('ingrese el indice de la modulacion: ');
Fi=A*cos((wc*t)+(mf*sin(wm*t)));
figure(1)
plot(t,Fi,'linewidth',2)
axis([0 2*pi -1.2 1.2])
xlabel ('tiempo (t)')
ylabel ('funcion Fi(t)')
title ('Señal fm con indice mf = x')

N=legenth (Fi);
%espectro de fi
X=fftshift(fft(Fi,N))/N;
%Frecuencia discreta
f=linspane(-N/2,(N/2),N);
%VISUALIZA RESULYADOS
figure (2)
plot(f/100,abs(x),'linewidth',1.4)
axis ([-3.3 3.3 -0.005 0.15])
xlabel ('Frecuencia (w)')
ylabel ('Fi(w)')
title ('espectro discreto de pi[w] con mf = x')

%usando los comando fmmod y fmdemod

t=0:.01:4*pi;
fc=wc/2*pi;
fs=length(t);
x=cos(Wm*t);
%desviacion de frecuencia
dw=mf*wm;

FM=fmmod(x,fc,fs,dw);
figure(3)
plot(t,FM,'linewidth',2)
axis([0 2*pi -1.2 1.2])
xlabel ('tiempo (t)')
ylabel ('Funcion FI(t)')
title('señal FM con indice mf = x')

DEM=fmdemod(FM,fc,fs,dw);
figure(4)
plot(t,DEM)
axis([0 4*pi -1.2 1.2])
xlabel('tiempo (t)')
ylabel('Funcion Fi(t)')
title ('Señal demodulada FM con indice mf = x')

You might also like