# modnorm

Scaling factor for normalizing modulation output

## Syntax

```scale = modnorm(const, 'avpow', avpow)scale = modnorm(const, 'peakpow', peakpow)```

## Description

```scale = modnorm(const, 'avpow', avpow)``` returns a scale factor for normalizing a PAM or QAM modulator output such that its average power is `avpow` (watts). `const` is a vector specifying the reference constellation used to generate the scale factor. The function assumes that the signal to be normalized has a minimum distance of 2.

```scale = modnorm(const, 'peakpow', peakpow)``` returns a scale factor for normalizing a PAM or QAM modulator output such that its peak power is `peakpow` (watts).

## Examples

The code below illustrates how to use `modnorm` to transmit a quadrature amplitude modulated signal having a peak power of one watt.

```M = 16; % Alphabet size % QAM Modulation hMod = comm.RectangularQAMModulator(M); hDemod = comm.RectangularQAMDemodulator(M); % AWGNChannel System object hChan = comm.AWGNChannel('NoiseMethod', 'Signal to noise ratio (SNR)', ... 'SNR', 10); const = step(hMod,(0:M-1)'); % Generate the constellation. x = randi([0 M-1], 100,1); scale = modnorm(const,'peakpow',1); % Compute scale factor. y = scale * step(hMod,x); % Modulate and scale. hChan.SignalPower = (y' * y)/ length(y); % Calculate Signal Power ynoisy = step(hChan,y); % Transmit along noisy channel. ynoisy_unscaled = ynoisy/scale; % Unscale at receiver end. z = step(hDemod,ynoisy_unscaled); % Demodulate. % See how scaling affects constellation. h = scatterplot(const,1,0,'ro'); % Unscaled constellation hold on; % Next plot will be in same figure window. scatterplot(const*scale,1,0,'bx',h); % Scaled constellation hold off;```

In the plot below, the plotting symbol `o` marks points on the original QAM signal constellation, and the plotting symbol `x` marks points on the signal constellation as scaled by the output of the `modnorm` function. The channel in this example carries points from the scaled constellation.