Modulation for communications simulation - MATLAB modulate (2024)

Modulation for communications simulation

collapse all in page

Syntax

y = modulate(x,fc,fs)

[y,t] = modulate(x,fc,fs)

[___] = modulate(x,fc,fs,method)

[___] = modulate(x,fc,fs,method,opt)

Description

y = modulate(x,fc,fs) modulates the real message signal x with a carrier frequency fc and sample rate fs. If x is a matrix, the modulated signal is computed independently for each column and stored in the corresponding column of y.

[y,t] = modulate(x,fc,fs) also returns the internal time vector t.

example

[___] = modulate(x,fc,fs,method) modulates the real message signal using the modulation technique specified by method. You can use these inputs with either of the previous output syntaxes.

example

[___] = modulate(x,fc,fs,method,opt) uses the additional options specified in opt for some modulation methods.

Examples

collapse all

Single-Sideband Amplitude Modulation

Open Live Script

Generate a 10 Hz sinusoidal signal sampled at a rate of 200 Hz for 1 second. Embed the sinusoid in white Gaussian noise of variance 0.01.

fs = 200;t = 0:1/fs:1;x = sin(2*pi*10*t) + randn(size(t))/10;

Single-sideband amplitude modulate the signal with a carrier frequency of 50 Hz. Compute and display the new Welch's power spectral density estimates.

y = modulate(x,50,fs,'amssb');pwelch([x;y]',hamming(100),80,1024,fs,'centered')

Modulation for communications simulation - MATLAB modulate (1)

Quadrature Amplitude Modulation of Two Sinusoidal Signals

Open Live Script

Generate two sinusoidal signals frequencies of 10 Hz and 20 Hz, sampled at a rate of 200 Hz for 1 second. Embed the sinusoids in white Gaussian noise of variance 0.01.

fs = 200;t = 0:1/fs:1;i = sin(2*pi*10*t) + randn(size(t))/10;q = sin(2*pi*20*t) + randn(size(t))/10;

Create a quadrature amplitude modulated signal from signals i and q using a carrier frequency of 70 Hz. Compute the Welch power spectral density estimates of the original and modulated sequences. Use a 100-sample Hamming window with 80 samples of overlap. Specify an FFT length of 1024.

y = modulate(i,70,fs,'qam',q);pwelch([i;q;y]',hamming(100),80,1024,fs,'centered') legend('In-phase signal','Quadrature signal','Modulated signal')

Modulation for communications simulation - MATLAB modulate (2)

Input Arguments

collapse all

xMessage signal
real vector | real matrix

Message signal, specified as a real vector or matrix.

Example: sin(2*pi*25*[0:(1/200):1])

fcCarrier frequency
real positive scalar

Carrier frequency used to modulate the message signal, specified as a real positive scalar.

fsSample rate
real positive scalar

Sample rate, specified as a real positive scalar.

methodMethod of modulation used
'am' (default) | 'amdsb-tc' | 'amssb' | 'fm' | 'pm' | 'pwm' | 'ppm' | 'qam'

Method of modulation used, specified as one of:

  • amdsb-sc or am — Amplitude modulation, double sideband, suppressed carrier. Multiplies x by a sinusoid of frequency fc.

    y = x.*cos(2*pi*fc*t)
  • amdsb-tc — Amplitude modulation, double sideband, transmitted carrier. Subtracts scalar opt from x and multiplies the result by a sinusoid of frequency fc.

    y = (x-opt).*cos(2*pi*fc*t)

    If you do not specify the opt parameter, modulate uses a default of min(min(x)) so that the message signal (x-opt) is entirely nonnegative and has a minimum value of 0.

  • amssb — Amplitude modulation, single sideband. Multiplies x by a sinusoid of frequency fc and adds the result to the Hilbert transform of x multiplied by a phase-shifted sinusoid of frequency fc.

    y = x.*cos(2*pi*fc*t)+imag(hilbert(x)).*sin(2*pi*fc*t)

    This effectively removes the upper sideband.

  • fm — Frequency modulation. Creates a sinusoid with instantaneous frequency that varies with the message signal x.

    y = cos(2*pi*fc*t + opt*c*msum(x))

    c*msum is a rectangular approximation of the integral of x. modulate uses opt as the constant of frequency modulation. If you do not specify the opt parameter, modulate uses a default of opt=(fc/fs)*2*pi/(max(max(x))) so the maximum frequency excursion from fc is fcHz.

  • pm — Phase modulation. Creates a sinusoid of frequency fc whose phase varies with the message signal x.

    y = cos(2*pi*fc*t + opt*x)

    modulate uses opt as the constant of phase modulation. If you do not specify the opt parameter, modulate uses a default of opt=pi/(max(max(x))) so the maximum phase excursion is π radians.

  • pwm — Pulse-width modulation. Creates a pulse-width modulated signal from the pulse widths in x. The elements of x must be between 0 and 1, specifying the width of each pulse in fractions of a period. The pulses start at the beginning of each period, that is, they are left justified. modulate(x,fc,fs,'pwm','centered') yields pulses centered at the beginning of each period. The length of y is length(x)*fs/fc.

  • ppm — Pulse-position modulation. Creates a pulse-position modulated signal from the pulse positions in x. The elements of x must be between 0 and 1, specifying the left edge of each pulse in fractions of a period. opt is a scalar between 0 and 1 that specifies the length of each pulse in fractions of a period. The default for opt is 0.1. The length of y is length(x)*fs/fc.

  • qam— Quadrature amplitude modulation. Creates a quadrature amplitude modulated signal from signals x and opt.

    y = x.*cos(2*pi*fc*t) + opt.*sin(2*pi*fc*t)

    The input argument opt must be the same size as x.

optOptional input for some methods
real vector

Optional input, specified for some methods. Refer to method for more details on how to use opt.

Output Arguments

collapse all

y — Modulated signal
real vector | real matrix

Modulated message signal, returned as a real vector or matrix. Except for the methods pwm and ppm, y is the same size as x.

t — Internal time array
real vector

Internal time array used by modulate in its computations, specified as a real vector.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a

expand all

Generate C and C++ code for the modulate function. You must have MATLAB® Coder™ to use this functionality.

See Also

demod | vco

MATLAB Command

You clicked a link that corresponds to this MATLAB command:

 

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Modulation for communications simulation - MATLAB modulate (3)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本 (日本語)
  • 한국 (한국어)

Contact your local office

Modulation for communications simulation - MATLAB modulate (2024)

FAQs

How do you calculate modulation in Matlab? ›

y = modulate( x , fc , fs ) modulates the real message signal x with a carrier frequency fc and sample rate fs . If x is a matrix, the modulated signal is computed independently for each column and stored in the corresponding column of y . [ y , t ] = modulate( x , fc , fs ) also returns the internal time vector t .

What is modulation answers? ›

Modulation is defined as the process of superimposing a low-frequency signal on a high-frequency carrier signal. Or. The process of varying the RF carrier wave in accordance with the information in a low-frequency signal.

How to do FM modulation in Matlab? ›

FM Modulate a Sinusoidal Signal

fs = 1000; fc = 200; t = (0:1/fs:0.2)'; Create two tone sinusoidal signal with frequencies 30 and 60 Hz. x = sin(2*pi*30*t)+2*sin(2*pi*60*t); Set the frequency deviation to 50 Hz.

What is the three 3 modulation techniques? ›

There are three types of modulation: Amplitude Modulation. Frequency Modulation. Phase Modulation.

How do you calculate modulation? ›

Modulation factor is expressed as the rate of change of amplitude in the carrier wave after the process of modulation to the amplitude of the unmodulated carrier wave: ∴ Modulation factor ( m ) = Amplitude change of carrier wave after modulation Amplitude change of carrier wave before modulation.

What is the formula for modulation? ›

Equation 1. m(t) = Am cos (2*pi*fm*t), Am=3, fm=5 Hz, t=time. Equation 2 represents the carrier wave which is just another sinusoidal wave function.

What is an example of modulation in communication? ›

Each type of modulation has its advantages and is suitable for different applications. For example, AM is commonly used in radio broadcasting, FM in high-fidelity audio transmission, and PM in certain digital communication systems.

What is an example of modulation in communication system? ›

Why use modulation in communications? Multiple carriers of different frequencies can often be transmitted over a single media, with each carrier being modulated by an independent signal. For example, Wi-Fi uses individual channels to simultaneously transmit data to and from multiple clients.

What is modulation in communication? ›

In electronics and telecommunications, modulation is the process of varying one or more properties of a periodic waveform, called the carrier signal, with a separate signal called the modulation signal that typically contains information to be transmitted.

What is the code for demodulation and modulation in Matlab? ›

Amplitude modulate the signal s . y = ammod(s,fc,fs); Demodulate the received signal. z = amdemod(y,fc,fs,0,0,num,den);

What is frequency modulation in Matlab? ›

Frequency modulation (FM) is a baseband modulation technique in which the message modulates the frequency of a constant amplitude signal. The transmitted signal is created by switching the carrier frequency at data transitions.

What is the code for phase modulation in Matlab? ›

Description. y = pmmod( x , Fc , Fs , phasedev ) modulates the message signal x using phase modulation. y = pmmod( x , Fc , Fs , phasedev , ini_phase ) specifies the initial phase of the modulated signal in radians.

Why do we need modulation in communication? ›

The strength of the message signal should be increased so that it can travel longer distances. This is where modulation is essential. The most vital need of modulation is to enhance the strength of the signal without affecting the parameters of the carrier signal.

What is the simplest modulation technique? ›

Common digital modulation techniques include amplitude-shift keying (ASK), frequency-shift keying (FSK), and phase-shift keying (PSK). ASK is the simplest of these techniques, and is used for low-speed data transmission. FSK is more complex and is used for high-speed data transmission.

What is the best modulation technique? ›

Quadrature amplitude modulation is the best modulation technique. It is used in internet traffic between cable modem and modem termination system and transmission of DTV.

What is ppm modulation in Matlab? ›

Share 'Pulse-position modulation (PPM) Matlab Code'

Pulse-position modulation (PPM) is a form of signal modulation in which M message bits are encoded by transmitting a single pulse in one of {\displaystyle 2^{M}} possible required time shifts.

What is the formula of modulation frequency? ›

As we learned from amplitude modulation, we want 2 sine waves or cosines for modulation. Then frequency modulated wave will be; fm(t) = fc + k Am. cos (2π fm t)

Top Articles
Latest Posts
Article information

Author: Terence Hammes MD

Last Updated:

Views: 5934

Rating: 4.9 / 5 (49 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Terence Hammes MD

Birthday: 1992-04-11

Address: Suite 408 9446 Mercy Mews, West Roxie, CT 04904

Phone: +50312511349175

Job: Product Consulting Liaison

Hobby: Jogging, Motor sports, Nordic skating, Jigsaw puzzles, Bird watching, Nordic skating, Sculpting

Introduction: My name is Terence Hammes MD, I am a inexpensive, energetic, jolly, faithful, cheerful, proud, rich person who loves writing and wants to share my knowledge and understanding with you.