Time varying gain control
TimeVaryingGain object applies a time varying
gain to input signals. Time varying gain (TVG) is sometimes called
automatic gain control (AGC).
To apply the time varying gain to the signal:
Starting in R2016b, instead of using the
to perform the operation defined by the System object™, you can
call the object with arguments, as if it were a function. For example,
= step(obj,x) and
y = obj(x) perform
H = phased.TimeVaryingGain creates a time
varying gain control System object,
object applies a time varying gain to the input signal to compensate
for the signal power loss due to the range.
H = phased.TimeVaryingGain( creates
H, with each specified property Name
set to the specified Value. You can specify additional name-value
pair arguments in any order as (
Source of range losses
Specify the source of range losses as either
Loss at each input sample range
Specify the loss due to range as a vector — elements correspond to the samples in the input signal. Units are in dB. This property can have single or double precision.
Loss at reference range
Specify the loss at a given reference range as a scalar. Units are in dB. This property can have single or double precision.
|step||Apply time varying gains to input signal|
|Common to All System Objects|
Allow System object property value changes
Apply Time Varying Gain to Adjust for Range Loss
Apply time varying gain to a signal to compensate for signal power loss due to range.
First, create a signal with range loss. Set the reference loss to 16 dB.
rngloss = 10:22; refloss = 16; t = (1:length(rngloss))'; x = 1./db2mag(rngloss(:));
Then add gain to compensate for range loss.
gain = phased.TimeVaryingGain('RangeLoss',rngloss,'ReferenceLoss',refloss); y = gain(x);
Plot the signal with loss and the compensated signal.
tref = find(rngloss==refloss); stem([t t],[abs(x) abs(y)]) hold on stem(tref,x(tref),'filled','r') xlabel('Time (s)'); ylabel('Magnitude (V)') grid on legend('Before time varying gain','After time varying gain',... 'Reference range')
This System object supports single and double precision for input data, properties, and arguments. If
the input data
X is single precision, the output data is single precision.
If the input data
X is double precision, the output data is double
precision. The precision of the output is independent of the precision of the properties and
 Edde, B. Radar: Principles, Technology, Applications. Englewood Cliffs, NJ: Prentice Hall, 1993.
 Skolnik, M. Introduction to Radar Systems, 3rd Ed. New York: McGraw-Hill, 2001.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
See System Objects in MATLAB Code Generation (MATLAB Coder).
This System object supports single and double precision for input data, properties, and arguments. If the input data
Xis single precision, the output data is single precision. If the input data
Xis double precision, the output data is double precision. The precision of the output is independent of the precision of the properties and other arguments.