This part is regarding acquiring information for the modulation process of a WAV file saved on the computer’s memory to be modulated using MATLAB, taken directly from online help documentations:
http://www.mathworks.com/access/helpdesk/help/toolbox/comm/ug/fp59183.html
Modulation ^{[1] }in MATLAB
In most media for communication, only a fixed range of frequencies is available for transmission. One way to communicate a message signal whose frequency spectrum does not fall within that fixed frequency range, or one that is otherwise unsuitable for the channel, is to alter a transmittable signal according to the information in your message signal. This alteration is called modulation, and it is the modulated signal that you transmit. The receiver then recovers the original signal through a process called demodulation.
The sections of this chapter are as follows.
Modulation Features of the Toolbox
Modulation Terminology
Analog Modulation
Digital Modulation
Using Modem Objects
Selected Bibliography for Modulation
Modulation Features of the Toolbox ^{[2]}
The available methods of modulation depend on whether the input signal is analog or digital. The tables below show the modulation techniques that the Communications Toolbox supports for analog and digital signals, respectively.
Analog Modulation Method 
Acronym 
Function or Method 
Amplitude modulation (suppressed or transmitted carrier) 
AM 
ammod, amdemod 
Frequency modulation 
FM 
fmmod, fmdemod 
Phase modulation 
PM 
pmmod, pmdemod 
Single sideband amplitude modulation 
SSB 
ssbmod, ssbdemod 
Digital Modulation Method 
Acronym 
Function or Method 
Differential phase shift keying modulation 
DPSK 
dpskmod, dpskdemod 
Frequency shift keying modulation 
FSK 
fskmod, fskdemod 
Minimum shift keying modulation 
MSK 
mskmod, mskdemod 
Offset quadrature phase shift keying modulation 
OQPSK 
oqpskmod, oqpskdemod 
Phase shift keying modulation 
PSK 
modulate method on modem.pskmod object, demodulate method on modem.pskdemod object 
Pulse amplitude modulation 
PAM 
pammod 
Quadrature amplitude modulation 
QAM 
modulate method on modem.qammod object, demodulate method on modem.qamdemod object 
Baseband vs. Passband Simulation
For a given modulation technique, two ways to simulate modulation techniques are called baseband and passband. Baseband simulation, also known as the lowpass equivalent method, requires less computation. This toolbox supports baseband simulation for digital modulation and passband simulation for analog modulation.
Modulation Terminology
Modulation is a process by which a carrier signal is altered according to information in a message signal. The carrier frequency, denoted Fc, is the frequency of the carrier signal. The sampling rate is the rate at which the message signal is sampled during the simulation.
The frequency of the carrier signal is usually much greater than the highest frequency of the input message signal. The Nyquist sampling theorem requires that the simulation sampling rate Fs be greater than two times the sum of the carrier frequency and the highest frequency of the modulated signal in order for the demodulator to recover the message correctly.
Analog Modulation ^{[3]}
This section describes how to represent analog signals using vectors or matrices. It provides examples of using the analog modulation and demodulation functions.
Representing Analog Signals
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 twochannel 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)];
Analog Modulation Example
This example illustrates the basic format of the analog modulation and demodulation functions. Although the example uses phase modulation, most elements of this example apply to other analog modulation techniques as well.
The example samples an analog signal and modulates it. Then it simulates an additive white Gaussian noise (AWGN) channel, demodulates the received signal, and plots the original and demodulated signals.
% Prepare to sample a signal for two seconds, % at a rate of 100 samples per second. Fs = 100; % Sampling rate t = [0:2*Fs+1]'/Fs; % Time points for sampling % Create the signal, a sum of sinusoids. x = sin(2*pi*t) + sin(4*pi*t); Fc = 10; % Carrier frequency in modulation phasedev = pi/2; % Phase deviation for phase modulation y = pmmod(x,Fc,Fs,phasedev); % Modulate. y = awgn(y,10,'measured',103); % Add noise. z = pmdemod(y,Fc,Fs,phasedev); % Demodulate. % Plot the original and recovered signals. figure; plot(t,x,'k',t,z,'g'); legend('Original signal','Recovered signal');
Other examples using analog modulation functions appear in the reference pages for ammod, amdemod, ssbdemod, and fmmod.
Digital Modulation ^{[4]}
Like analog modulation, digital modulation alters a transmittable signal according to the information in a message signal. However, in this case, the message signal is restricted to a finite set. Using this toolbox, you can modulate or demodulate signals using various digital modulation techniques, listed in Modulation Features of the Toolbox. You can also plot signal constellations.
The topics in this section are as follows:
Representing Digital Signals
To modulate a signal using digital modulation with an alphabet having M symbols, start with a real message signal whose values are integers from 0 to M1. Represent the signal by listing its values in a vector, x. Alternatively, you can use a matrix to represent a multichannel signal, where each column of the matrix represents one channel.
For example, if the modulation uses an alphabet with eight symbols, then the vector [2 3 7 1 0 5 5 2 6]' is a valid singlechannel input to the modulator. As a multichannel example, the twocolumn matrix
[2 3; 3 3; 7 3; 0 3;]
defines a twochannel signal in which the second channel has a constant value of 3.
Baseband Modulated Signals Defined
If you use baseband modulation to produce the complex envelope y of the modulation of a message signal x, then y is a complexvalued signal that is related to the output of a passband modulator. If the modulated signal has the waveform
where f_{c} is the carrier frequency and θ is the carrier signal’s initial phase, then a baseband simulation recognizes that this equals the real part of
and models only the part inside the square brackets. Here j is the square root of 1. The complex vector y is a sampling of the complex signal
If you prefer to work with passband signals instead of baseband signals, then you can build functions that convert between the two. Be aware that passband modulation tends to be more computationally intensive than baseband modulation because the carrier signal typically needs to be sampled at a high rate.
Gray Encoding a Modulated Signal
For the PSK, DPSK, FSK, QAM, and PAM modulation types, Gray constellations are obtained by selecting the gray parameter in the corresponding modulation function or method.
Note that Grayencoding the signal with bin2gray and then modulating it without the gray parameter does not result in a Grayencoded modulation for the PSK, DPSK, FSK, QAM, and PAM cases. This is due to the modulation functions using symbol values instead of the symbol positions.
As an example, let’s try to make a Gray constellation using PSK modulation. The following examples describe incorrect and correct procedures for making a Gray constellation.
Incorrect Procedure
As an example of how not to do this, this procedure uses bin2gray to Graycode a signal, and subsequently modulates it. The result is a modulation that is not Graycoded.
y = bin2gray([0:7],'psk',8); xmap = modulate(modem.pskmod(8),y); k=log2(8); scatterplot(xmap); set(get(gca,'Children'),'Marker','d','MarkerFaceColor','auto'); hold on; for jj=1:length(xmap) text(real(xmap(jj))0.15,imag(xmap(jj))+0.15,... dec2base(jj1,2,3)); end set(gca,'yTick',((k+1)/4:(k+1)/4),'xTick',((k+1)/4:(k+1)/4),... 'XLim',[(k+1)/2 (k+1)/2],'YLim',... [(k+1)/2 (k+1)/2],'Box','on','YGrid','on', 'XGrid','on'); hold off; title({'Scatter plot 8PSK pre Gray encoding',... 'input = bin2gray([0:7],''psk'',8)=[0,1,3,2,6,7,5,4]'});
Looking at the map above, notice that this is not a Grayencoded map; there are cases where adjacent elements differ by more than one bit.
Correct Procedure
The correct procedure uses the pskmod function with the gray parameter.
y = [0:7]; xmap = modulate(modem.pskmod('M',8,'SymbolOrder','Gray'),y); k=log2(8); scatterplot(xmap); set(get(gca,'Children'),'Marker','d','MarkerFaceColor','auto'); hold on; for jj=1:length(xmap) text(real(xmap(jj))0.15,imag(xmap(jj))+0.15,... dec2base(jj1,2,3)); end set(gca,'yTick',((k+1)/4:(k+1)/4),'xTick',((k+1)/4:(k+1)/4),... 'XLim',[(k+1)/2 (k+1)/2],'YLim',[(k+1)/2 (k+1)/2],... 'Box','on','YGrid','on', 'XGrid','on'); hold off;
Looking at the map above, notice that this is indeed a Grayencoded map; all adjacent elements differ by only one bit.
Examples of Digital Modulation and Demodulation
This section contains examples that illustrate how to use the digital modulation and demodulation functions.
Computing the Symbol Error Rate
The example generates a random digital signal, modulates it, and adds noise. Then it creates a scatter plot, demodulates the noisy signal, and computes the symbol error rate. For a more elaborate example that is similar to this one, see Modulating a Random Signal.
% Create a random digital message M = 16; % Alphabet size x = randint(5000,1,M); % Use 16QAM modulation to produce y. y=modulate(modem.qammod(M),x); % Transmit signal through an AWGN channel. ynoisy = awgn(y,15,'measured'); % Create scatter plot from noisy data. scatterplot(ynoisy); % Demodulate ynoisy to recover the message. z=demodulate(modem.qamdemod(M),ynoisy); % Check symbol error rate. [num,rt]= symerr(x,z)
The output and scatter plot are below. Your numerical results and plot might vary, because the example uses random numbers.
num = 83 rt = 0.0166
The scatter plot does not look exactly like a signal constellation. Where the signal constellation has 16 precisely located points, the noise causes the scatter plot to have a small cluster of points approximately where each constellation point would be.
Combining Pulse Shaping and Filtering with Modulation
Modulation is often followed by pulse shaping, and demodulation is often preceded by a filtering or an integrateanddump operation. This section presents an example involving rectangular pulse shaping. For an example that uses raised cosine pulse shaping, see Pulse Shaping Using a Raised Cosine Filter.
Rectangular Pulse Shaping. Rectangular pulse shaping repeats each output from the modulator a fixed number of times to create an upsampled signal. Rectangular pulse shaping can be a first step or an exploratory step in algorithm development, though it is less realistic than other kinds of pulse shaping. If the transmitter upsamples the modulated signal, then the receiver should downsample the received signal before demodulating. The “integrate and dump” operation is one way to downsample the received signal.
The code below uses the rectpulse function for rectangular pulse shaping at the transmitter and the intdump function for downsampling at the receiver.
M = 16; % Alphabet size x = randint(5000,1,M); % Message signal Nsamp = 4; % Oversampling rate % Use 16QAM modulation. y = modulate(modem.qammod(M),x); % Follow with rectangular pulse shaping. ypulse = rectpulse(y,Nsamp); % Transmit signal through an AWGN channel. ynoisy = awgn(ypulse,15,'measured'); % Downsample at the receiver. ydownsamp = intdump(ynoisy,Nsamp); % Demodulate to recover the message. z = demodulate(modem.qamdemod(M),ydownsamp);
Plotting Signal Constellations
To plot the signal constellation associated with a modulation process, follow these steps:

If the alphabet size for the modulation process is M, then create the signal [0:M1]. This signal represents all possible inputs to the modulator.

Use the appropriate modulation function to modulate this signal. If desired, scale the output. The result is the set of all points of the signal constellation.

Apply the scatterplot function to the modulated output to create a plot.
Examples of Signal Constellation Plots
The following examples produce plots of signal constellations:
The reference entries for the modnorm and genqammod functions provide additional examples.
Constellation for 16PSK.
The code below plots a PSK constellation having 16 points.
M = 16; x = [0:M1]; scatterplot(modulate(modem.pskmod(M),x));
Constellation for 32QAM.
The code below plots a QAM constellation having 32 points and a peak power of 1 watt. The example also illustrates how to label the plot with the numbers that form the input to the modulator.
M = 32; x = [0:M1]; y = modulate(modem.qammod(M),x); scale = modnorm(y,'peakpow',1); y = scale*y; % Scale the constellation. scatterplot(y); % Plot the scaled constellation. % Include text annotations that number the points. hold on; % Make sure the annotations go in the same figure. for jj=1:length(y) text(real(y(jj)),imag(y(jj)),[' ' num2str(jj1)]); end hold off;
GrayCoded Signal Constellation.
The example below plots an 8QAM signal Graycoded constellation, labeling the points using binary numbers so you can verify visually that the constellation uses Gray coding.
M = 8; x = [0:M1]; y = modulate(modem.qammod('M',M,'SymbolOrder','Gray'),x); % Plot the Graycoded constellation. scatterplot(y,1,0,'b.'); % Dots for points. % Include text annotations that number the points in binary. hold on; % Make sure the annotations go in the same figure. annot = dec2bin([0:length(y)1],log2(M)); text(real(y)+0.15,imag(y),annot); axis([4 4 4 4]); title('Constellation for GrayCoded 8QAM'); hold off;
Customized Constellation for QAM. The code below describes and plots a constellation with a customized structure.
% Describe constellation. inphase = [1/2 1/2 1 0 3/2 3/2 1 1]; quadr = [1 1 0 2 1 1 2 2]; inphase = [inphase; inphase]; inphase = inphase(:); quadr = [quadr; quadr]; quadr = quadr(:); const = inphase + j*quadr; % Plot constellation. scatterplot(const,1,0,'*'); hold on; axis([3 3 3 3]); title('Customized Constellation for QAM'); hold off;
Using Modem Objects ^{[5]}
Modulation of signals is generally done through the use of functions, such as pammod and dpskmod. For PSK and QAM, however, modulation is done through the use of modem objects. This section gives an overview of how you use these objects.
A modem object is a type of MATLAB variable that contains information about the modulation algorithm, such as the name of the modulation class, Mary number, and the constellation mapping. The object can be operated upon using specific methods to perform certain tasks.
Constructing a Modem Object
To construct PSK and QAM modulator and demodulator objects, use the modem.pskmod, modem.pskdemod, modem.qammod, and modem.qamdemod functions (constructors). See individual reference pages for details.
Managing the Object’s Properties
To view the properties of a modem object, use its disp method, as shown in the following example:
h=modem.pskmod; % Construct a PSK modulator object. h.disp % Display object properties.
You can directly assign a value to a property as follows:
h=modem.pskmod(8); % Construct a PSK modulator object. % Set the 'symbolorder' property of the object to 'gray'. h.symbolorder='gray';
The properties can also be set to specific values when constructing the object. See reference pages of individual objects for details.
Basic Procedure for Modulating or Demodulating a Signal
Modulating a signal with PSK or QAM involves these steps:

Create a modem object using modem.pskmod or modem.qammod, depending on your modulation type.

Adjust properties of the modem object, if necessary, to tailor it to your needs. For example, you can change the phase offset or symbol order.

Modulate your signal by applying the modulate method of the modem object.
Demodulating a PSK or QAM modulated signal is performed in a way similar to how you did the modulation except that you use modem.pskdemod or modem.qamdemod objects, and apply the demodulate method of the modem object.
Example Illustrating the Basic Procedure
This code briefly illustrates the steps in the basic procedure previously described.
x = randint(n,1); % Create a signal source. h = modem.qammod(8) % Create a modulator object % and display its properties. y = modulate(h,x); % Modulate the signal x. g = modem.qamdemod(h) % Create a demodulator object % from a modem.qammod object % and display its properties. z = demodulate(g,y); % Demodulate the signal y.
Selected Bibliography for Modulation ^{[6]}
[1] Jeruchim, Michel C., Philip Balaban, and K. Sam Shanmugan, Simulation of Communication Systems, New York, Plenum Press, 1992.
[2] Proakis, John G., Digital Communications, 3rd ed., New York, McGrawHill, 1995.
[3] Sklar, Bernard, Digital Communications: Fundamentals and Applications, Englewood Cliffs, NJ, PrenticeHall, 1988.
Special Filters
The Communications Toolbox includes several functions that can help you design and use filters. Other filtering capabilities are in the Signal Processing Toolbox. The sections of this chapter are as follows.
For a demonstration involving raised cosine filters, type showdemo rcosdemo.
Noncausality and the Group Delay Parameter
Without propagation delays, both Hilbert filters and raised cosine filters are noncausal. This means that the current output depends on the system’s future input. In order to design only realizable filters, the hilbiir, rcosine, and rcosflt functions delay the input signal before producing an output. This delay, known as the filter’s group delay, is the time between the filter’s initial response and its peak response. The group delay is defined as
where θ is the phase of the filter and ω is the frequency in radians. This delay is set so that the impulse response before time zero is negligible and can safely be ignored by the function.
For example, the Hilbert filter whose impulse is shown below uses a group delay of one second. In the figure, the impulse response near time 0 is small and the large impulse response values occur near time 1.
Example: Compensating for Group Delays When Analyzing Data
Comparing filtered with unfiltered data might be easier if you delay the unfiltered signal by the filter’s group delay. For example, suppose you use the code below to filter x and produce y.
tx = 0:4; % Times for data samples x = [0 1 1 1 1]'; % Binary data samples % Filter the data and use a delay of 2 seconds. delay = 2; [y,ty] = rcosflt(x,1,8,'fir',.3,delay);
The elements of tx and ty represent the times of each sample of x and y, respectively. However, y is delayed relative to x, so corresponding elements of x and y do not have the same time values. Plotting y against ty and x against tx is less useful than plotting y against ty and x against a delayed version of tx.
% Top plot subplot(2,1,1), plot(tx,x,'*',ty,y); legend('Data','Filtered data'); title('Data with No Added Delay'); % Bottom plot delays tx. subplot(2,1,2), plot(tx+delay,x,'*',ty,y); legend('Data','Filtered data'); title('Data with an Added Delay');
For another example of compensating for group delay, see the raised cosine filter demo by typing showdemo rcosdemo.
Designing Hilbert Transform Filters
The hilbiir function designs a Hilbert transform filter and produces either

A plot of the filter’s impulse response

A quantitative characterization of the filter, using either a transfer function model or a statespace model
Example with Default Parameters
For example, typing
hilbiir
plots the impulse response of a fourthorder digital Hilbert transform filter having a onesecond group delay. The sample time is 2/7 seconds. In this particular design, the tolerance index is 0.05. The plot also displays the impulse response of the ideal Hilbert transform filter having a onesecond group delay. The plot is in the figure in Noncausality and the Group Delay Parameter.
To compute this filter’s transfer function, use the command below.
[num,den] = hilbiir num = 0.3183 0.3041 0.5160 1.8453 3.3105 den = 1.0000 0.4459 0.1012 0.0479 0.0372
The vectors num and den contain the coefficients of the numerator and denominator, respectively, of the transfer function in ascending order of powers of z^{1}.
The commands in this section use the function’s default parameters. You can also control the filter design by specifying the sample time, group delay, bandwidth, and tolerance index. The reference entry for hilbiir explains these parameters. The group delay is also mentioned in Noncausality and the Group Delay Parameter.
Filtering with Raised Cosine Filters
The rcosflt function applies a raised cosine filter to data. Because rcosflt is a versatile function, you can
This section discusses the use of sampling rates in filtering and then covers these options. For an additional example, type showdemo rcosdemo in the MATLAB Command Window.
Sampling Rates
The basic rcosflt syntax
y = rcosflt(x,Fd,Fs...) % Basic syntax
assumes by default that you want to apply the filter to a digital signal x whose sampling rate is Fd. The filter’s sampling rate is Fs. The ratio of Fs to Fd must be an integer. By default, the function upsamples the input data by a factor of Fs/Fd before filtering. It upsamples by inserting Fs/Fd1 zeros between consecutive input data samples. The upsampled data consists of Fs/Fd samples per symbol and has a sampling rate of Fs.
An example using this syntax is below. The output sampling rate is four times the input sampling rate.
y1 = rcosflt([1;0;0],1,4,'fir'); % Upsample by factor of 4/1.
Maintaining the Input Sampling Rate
You can also override the default upsampling behavior. In this case, the function assumes that the input signal already has a sampling rate of Fs and consists of Fs/Fd samples per symbol. You might want to maintain the sampling rate in a receiver’s filter if the corresponding transmitter’s filter has already upsampled sufficiently.
To maintain the sampling rate, modify the fourth input argument in rcosflt to include the string Fs. For example, in the first command below, rcosflt uses its default upsampling behavior and the output sampling rate is four times the input sampling rate. By contrast, the second command below uses Fs in the string argument and thus maintains the sampling rate throughout.
y1 = rcosflt([1;0;0],1,4,'fir'); % Upsample by factor of 4/1. y2 = rcosflt([1;0;0],1,4,'fir/Fs'); % Maintain sampling rate.
The second command assumes that the sampling rate of the input signal is 4, and that the input signal contains 4/1 samples per symbol.
An example that uses the 'Fs' option at the receiver is in Combining Two SquareRoot Raised Cosine Filters.
Designing Filters Automatically
The simplest syntax of rcosflt assumes that the function should both design and implement the raised cosine filter. For example, the command below designs an FIR raised cosine filter and then filters the input vector [1;0;0] with it. The second and third input arguments indicate that the function should upsample the data by a factor of 8 (that is, 8/1) during the filtering process.
y = rcosflt([1;0;0],1,8);
Types of Raised Cosine Filters
You can have rcosflt design other types of raised cosine filters by using a fourth input argument. Variations on the previous example are below.
y = rcosflt([1;0;0],1,8,'fir'); % Same as original example y = rcosflt([1;0;0],1,8,'fir/sqrt'); % FIR squareroot RC filter y = rcosflt([1;0;0],1,8,'iir'); % IIR raised cosine filter y = rcosflt([1;0;0],1,8,'iir/sqrt'); % IIR squareroot RC filter
Specifying Filters Using Input Arguments
If you have a transfer function for a raised cosine filter, then you can provide it as an input to rcosflt so that rcosflt does not design its own filter. This is useful if you want to use rcosine to design the filter once and then use the filter many times. For example, the rcosflt command below uses the 'filter' flag to indicate that the transfer function is an input argument. The input num is a vector that represents the FIR transfer function by listing its coefficients.
num = rcosine(1,8); y = rcosflt([1;0;0],1,8,'filter',num);
This syntax for rcosflt works whether num represents the transfer function for a squareroot raised cosine FIR filter or an ordinary raised cosine FIR filter. For example, the code below uses a squareroot raised cosine FIR filter. Only the definition of num is different.
num = rcosine(1,8,'sqrt'); y = rcosflt([1;0;0],1,8,'filter',num);
You can also use a raised cosine IIR filter. To do this, modify the fourth input argument of the rcosflt command above so that it contains the string 'iir' and provide a denominator argument. An example is below.
delay = 8; [num,den] = rcosine(1,8,'iir',.5,delay); y = rcosflt([1;0;0],1,8,'iir/filter',num,den,delay);
Controlling the Rolloff Factor
If rcosflt designs the filter automatically, then you can control the rolloff factor of the filter, as described below. If you specify your own filter, then rcosflt does not need to know its rolloff factor.
The rolloff factor determines the excess bandwidth of the filter. For example, a rolloff factor of .5 means that the bandwidth of the filter is 1.5 times the input sampling frequency, Fd. This also means that the transition band of the filter extends from .5 * Fd to 1.5 * Fd.
The default rolloff factor is .5, but if you want to use a value of .2, then you can use a command such as the one below. Typical values for the rolloff factor are between .2 and .5.
y = rcosflt([1;0;0],1,8,'fir',.2); % Rolloff factor is .2.
Controlling the Group Delay
If rcosflt designs the filter automatically, then you can control the group delay of the filter, as described below. If you specify your own FIR filter, then rcosflt does not need to know its group delay.
The filter’s group delay is the time between the filter’s initial response and its peak response. The default group delay in the implementation is three input samples. To specify a different value, measure it in input symbol periods and provide it as the sixth input argument. For example, the command below specifies a group delay of six input samples, which is equivalent to 6 *8 /1 output samples.
y = rcosflt([1;0;0],1,8,'fir',.2,6); % Delay is 6 input samples.
The group delay influences the size of the output, as well as the order of the filter if rcosflt designs the filter automatically. See the reference page for rcosflt for details that relate to the syntax you want to use.
Example: Raised Cosine Filter Delays
The code below filters a signal using two different group delays. A larger delay results in a smaller error in the frequency response of the filter. The plot shows how the two filtered signals differ, and the output pt indicates that the first peak occurs at different times for the two filtered signals. In the plot, the solid line corresponds to a delay of six samples, while the dashed line corresponds to a delay of eight samples.
[y,t] = rcosflt(ones(10,1),1,8,'fir',.5,6); % Delay = 6 samples [y1,t1] = rcosflt(ones(10,1),1,8,'fir',.5,8); % Delay = 8 samples plot(t,y,t1,y1,'') % Two curves indicate the different delays. legend('Delay = 6 samples','Delay = 8 samples','Location','NorthOutside'); peak = t(find(y == max(y))); % Times where first curve peaks peak1 = t1(find(y1 == max(y1))); % Times where second curve peaks pt = [min(peak), min(peak1)] % First peak time for both curves
The output is below.
pt = 14.6250 16.6250
If Fs/Fd is at least 4, then a group delay value of at least 8 works well in many cases. In the examples of this section, Fs/Fd is 8.
Delays of Six Samples (Solid Line) and Eight Samples (Dashed Line)
[1] Communications toolbox: Modulation. MATLAB Support Documentations
http://www.mathworks.com/access/helpdesk/help/toolbox/comm/ug/index.html?/access/helpdesk/help/toolbox/comm/ug/fp45657.html
[2] Modulation Features of the Toolbox, MATLAB Online Support Documentations
http://www.mathworks.com/access/helpdesk/help/toolbox/comm/ug/fp45665.html
[3] Analog Modulation
http://www.mathworks.com/access/helpdesk/help/toolbox/comm/ug/a1041263411.html
[4] Digital Modulation
http://www.mathworks.com/access/helpdesk/help/toolbox/comm/ug/a1041263435.html
[5] Using Modem Objects
http://www.mathworks.com/access/helpdesk/help/toolbox/comm/ug/bqwswmc1.html
[6] Selected Bibliography for Modulation
http://www.mathworks.com/access/helpdesk/help/toolbox/comm/ug/fp46681.html
Recent Comments