You are on page 1of 4

# Frequency Modulation/Demodulation

## Frequency Modulation/Demodulation and Noise (September 2010)

Jenna Rock
figure(2); plot(w,Mmag); axis ([-10000 10000 0 2]); title (Narrow Band FM - B=1'); xlabel ('Frequency (Hz)'); ylabel ('Magnitude')

AbstractThis goal in completing this project is to build an understanding of frequency modulation, demodulation and noise effects.

I. INTRODUCTION

HE purpose of this lab is to use and characterize Frequency Modulation using Matlab and Simulink. In addition to this the effects of noise will be observed.

II. THE FIVE QUESTIONS The following sections will discuss what was done for each part and the code needed to graph the function. Following that, the graph itself will be looked at. A. Frequency Modulation in Matlab For this first part of the lab frequency modulation is what is being demonstrated. Different betas will be chosen in order to show Narrow band FM, Wideband FM, and no carrier. Here is the MATLAB code that fulfilled the requirements. Ac = 10; fc = 5000; Am1 = 5; fm = 1000; fs = 10 * fc; ts = 1/fs; t = 0:ts:1-ts; %Narrow Band FM B = 1.0; m = Am1 * sin(2*pi*fc*t+B*sin(2*pi*fm*t)); c = Ac * sin(2*pi*fc*t); s = m.* c; figure(1); plot (t, m); axis ([0 0.00250 -10 10]); title ('Message Signal Narrow Band FM'); xlabel ('Time (s)'); ylabel ('Magnitude') %% Frequency Spectrum of M(f) and S(f)for Narrow Band FM Figure 2: Narrow Band FM - B=1 N=4096; Mmag = abs(fftshift(fft(m,N)))/N; w = fs * [-N/2+1:N/2]/N; %% Wide Band FM B=5; m = Am1 * sin(2*pi*fc*t+B*sin(2*pi*fm*t)) ; Figure 1: Message Signal - Narrow Band FM

Frequency Modulation/Demodulation figure(3); plot (t, m); axis ([0 0.00250 -10 10]); title ('Message Signal Wide Band FM'); xlabel ('Time (s)'); ylabel ('Magnitude') %% Frequency Spectrum of M(f) for Wide Band FM N=4096; Mmag = abs(fftshift(fft(m,N)))/N; w = fs * [-N/2+1:N/2]/N; figure(4); plot(w,Mmag); axis ([-15000 15000 0 2]); title ('Wide Band FM - B=5'); xlabel ('Frequency (Hz)'); ylabel ('Magnitude')

2 m = Am1 * sin(2*pi*fc*t+B*sin(2*pi*fm*t)) ; figure(5); plot (t, m); axis ([0 0.00250 -10 10]); title ('Message Signal No Carrier'); xlabel ('Time (s)'); ylabel ('Magnitude') N=4096; Mmag = abs(fftshift(fft(m,N)))/N; w = fs * [-N/2+1:N/2]/N; figure(6); plot(w,Mmag); axis ([-6000 6000 0 2]); title ('Figure 6: No Carrier - B=0'); xlabel ('Frequency (Hz)'); ylabel ('Magnitude')

## Figure 4: Wide Band FM - B=5 %%No Carrier B=0;

Figure 6: No Carrier - B=0 For this first part the code is provided for the solution. The figures for each section of code have been put after each section. As can be seen there were three sections, the

Frequency Modulation/Demodulation narrow band FM, wide band FM, and the no carrier. All of these sections were the same, except that the beta was change to achieve the various FM types. Also the figures were labeled differently. B. Frequency Modulation and Demodulation in Simulink For the second part of the lab Frequency Modulation will be demonstrated as well as how to demodulate is. Here is the Simulink model that fulfilled the requirements. Figure 10: Output from Scope1

C. Noise This part of the lab will show the effect of noise in frequency modulation. This will be shown in both Matlab and Simulink. Here is the MATLAB code that fulfilled the requirements. % Noise signal fs = 10000; ts = 1/fs; t = 0:ts:1-ts; nt = rand([1,10000]); timePlot = figure; plot (t,nt); title('Noise Signal - Time Domain'); xlabel('Time (s)'); ylabel('Amplitude'); grid % Plot of noise signal in Frequency Domain [Nf,NfRange] = centeredFFT(nt,fs); freqPlot = figure; stem(NfRange,Nf); title('Noise Signal - 2 Sided Spectrum') xlabel('Freq (Hz)'); ylabel('Amplitude'); grid; pause Figure 8: Output from Scope2 % Plot of autocorrelation of n(t) Rxx=xcorr(nt); ACorrPlot = figure; plot(Rxx); title('Autocorrelation Function of n(t)'); xlabel('time shift - lags'); ylabel('Autocorrelation'); grid;

Figure 7: Frequency Modulation and Demodulation The message and the dc offset were added together then were sent through a voltage controlled oscillator (VCO). At the end of the VCO the modulated signal was then put through a slope detector. The graphs produced by this Simulink block can be seen in Figure 8, Figure 9 and Figure 10.

## Figure 9: Output from Scope

Frequency Modulation/Demodulation

## Figure 14: Output from Scope

Figure 11: Autocorrelation in Time Domain Here is the block diagram that fulfills the requirements for the Simulink part of noise.

## Figure 15: Output from Scope1

III. CONCLUSION Looking back at the completion of this MATLAB project, it would need to be said that there is a lot more to be learned about Frequency Modulation than one lab can provide. This lab showed that only a very basic understanding of FM has been grasped. The lab was complete but not without great difficulty. If someone really wants to learn about FM much more time needs to be spent. However, this lab did fulfill its purpose in that FM modulation and demodulation was demonstrated. Also the effects of noise were observed. REFERENCES
[1] J. Santiago, Lab 3 Frequency Modulation/Demodulation and Noise handout.

Figure 12: Noise Effects in Simulink The message is added first with a dc offset. Following this the resultant signal has added to it noise. After this the signal plus noise is sent through a VCO and then a low pass filter or slope detector. The graphs produced by this Simulink block can be seen in Figure 13, Figure 14, and Figure 15.