##### Personal tools
•
You are here: Home Intro to Simulink and AM-DSB/SC Modulation

# Intro to Simulink and AM-DSB/SC Modulation

## Objective:

The objective of this lab is to help students become familiar with Simulink and amplitude modulation.

1. Start up Matlab.
2. Start up Simulink by typeing

at the Matlab prompt.  You should see the Simulink Block Library window as shown below.

4. From the file menu, select new model.  A Model window should open as shown below.

5. We will start by building and testing an AM-DSB/SC modulator.
6. Click on the Sources block in the Simulink Block Library window.  The Sources Block Library should open as shown below.

7. Drag and drop a Sine Wave block from the Sources Library to the Model window.
8. Click on the Blocksets & Toolboxes block in the Simulink Block Library window.  The Blocksets and Toolboxes window will open as shown below.

9. Open the DSP Blockset window by double clicking.  This will open the DSP Blockset Library window.
10. Finally when you open the DSP Sources window you will see this.

11. Drag and drop the Signal From Workspace block into the Model window.
12. Click on the Math block in the Simulink Block Library window.  The Math Block Library window should open as shown below.

13. Drag and drop the Product block onto the Model window.
14. Click on the Sinks block in the Simulink Block Library window.  The Sinks Block Library window should open as shown below.

15. Drag and drop the one Scope and one To Workspace block onto the Model window.
16. Connect the blocks with signal flow lines.
17. The Model window should now look like this.

18. Open the Sine Wave block by double clicking on it.  Set the parameters as follows.
19.  Parameter Value Comment Amplitude 1 Bias 0 Frequency (rad/sec) 2*pi*0.3 This is the carrier frequency Phase (rad) pi/2 This turns the sine into a cosine Sample time 1

20. Click OK when you are done to set the parameters of the Sine Wave block.
21. In the Matlab Command Window define the signal bumps by typing the following.
22. >> bump = sqrt(1250^2-([0:2499]-1250).^2) / 250;
>> bumps = [bump bump];
>> plot(bumps)

23. The resulting plot should look something like this.  Do you recognize the McDonelld's "Golden Arches"?

24. This signal is 5000 samples long and will be used as the modulating signal for our AM-DSB/SC modulator.
25. To let Simulink know that we want this for our source signal, double click the From Workspace block in the Model window and set the Parameters as shown below.
26.  Parameter Value Comment Data bumps.' Don't forget the transpose.  This needs to be a column vector not a row vector. Sample time 1 Samples per frame 1

27. Double click the To Workspace block in the Model window and set the Parameters as shown below.
28.  Parameter Value Comment Variable name am This will be the name of the variable in the Matlab workspace after you run the simulation. Save format Array Leave everything else at the default values.

When you are done the To Workspace Parameter window should look like this.

Click OK to set the values.
29. Save your model by selecting Save as... in the File menu in the Model window.  Call this model lab1.mdl.
30. Bring up the Simulation parameters... diaglog from the Simulation menu in the Model window.
31. Under Simulation time, change the Stop time to 5000.
32. Under Solver options, change the Type to Fixed-step.
33. The Simulaton Parameters window should look something like this.

34. Set the values by clicking OK.
35. Next select Start from the Simulation menu in the Model window.
36. Open the Scope display by double clicking on the scope.  Then you should see something like this.

37. You can zoom in to verify that this is an amlitude modulated wave corrresponding to the modulating signal given above.

38. By entering the following in the Matlab Command Window, you can see that the original modulating signal has been moved from baseband to the a carrier frequency at 0.3.
39. >> NFFT=2^16;
>> f=[0:NFFT-1]/NFFT;
>> AM=abs(fft(am(1,:).*blackman(length(am)).',NFFT));
>> plot(f,20*log10(AM));
>> axis([0 0.5 -20 80]);

Problems:
1. Write a Matlab function that will display the spectrum of a signal.  Here's some code that you may want to try:   sigspec.m
2. In the simulink model created above, there are three signals:  (1) the modulating signal, (2) the carrier signal, (3) the modulated signal.  The modulating signal and the modulated signal should already exist in the Matlab workspace.  Add another To Workspace block to the model and connect it to the carrier signal.  Run the simulation.  Then all three signals should exist in the Matlab workspace.  Use the sigspec.m function that you wrote previously to plot the spectra of the three signals.  Plot all three signals in the same figure window but in different axes.  Use the subplot function in Matlab to accomplish this.  If you have never used subplot, at the Matlab prompt, type
3. >> help subplot

4. Print a hard copy of the plots to turn in to the lab TA.  Write an explanation of the three plots.  Comment on the scaling of the modulated signal relative to the modulating signal. The scaling should be one half in the linear scale and -3dB on the log scale.  To get an accurate measurement, you may need to zoom in to read off the correct value of the peak. A log plot would look something like this