| Communications Toolbox | ![]() |
This section describes how to represent analog signals using vectors or matrices. It provides examples of using the analog modulation and demodulation functions.
To modulate an analog signal using this toolbox, start with a real message signal and a sampling rate Fs in hertz. Represent the signal using a vector x, the entries of which give the signal's values in time increments of 1/Fs. Alternatively, you can use a matrix to represent a multichannel signal, where each column of the matrix represents one channel.
For example, if t measures time in seconds, then the vector x below is the result of sampling a sine wave 8000 times per second for 0.1 seconds. The vector y represents the modulated signal.
Fs = 8000; % Sampling rate is 8000 samples per second. Fc = 300; % Carrier frequency in Hz t = [0:.1*Fs]'/Fs; % Sampling times for .1 second x = sin(20*pi*t); % Representation of the signal y = ammod(x,Fc,Fs); % Modulate x to produce y. figure; subplot(2,1,1); plot(t,x); % Plot x on top. subplot(2,1,2); plot(t,y)% Plot y below.

As a multichannel example, the code below defines a two-channel signal in which one channel is a sinusoid with zero initial phase and the second channel is a sinusoid with an initial phase of pi/8.
Fs = 8000; t = [0:.1*Fs]'/Fs; x = [sin(20*pi*t), sin(20*pi*t+pi/8)];
| Modulation Terminology | Analog Modulation Example | ![]() |
© 1994-2005 The MathWorks, Inc.