Robochameleon
v1.0
|
Signal description class. More...
Public Member Functions | |
function | signal_interface (in signal, in param) |
Class constructor. More... | |
function | fun1 (in obj, in fun) |
Apply a function to each signal component separately. More... | |
function | params (in obj) |
Returns signal parameters in a struct. More... | |
function | L (in obj) |
Retrieve the length of the signal. | |
function | N (in obj) |
Retrieve the number of signal components. | |
function | mtimes (in obj, in M) |
Jones matrix multiplication (overloads * operator) | |
function | Nss (in obj) |
Retrieve the number of samples per symbol. | |
function | Ts (in obj) |
Retrieve the sample period. | |
function | Tb (in obj) |
Retrieve the symbol period. | |
function | setPtot (in obj) |
Set total power from power per column. | |
function | end (in obj, in k, in n) |
Overload of indexing end statement. More... | |
function | subsref (in obj, in s) |
Overload indexing access for read the field. More... | |
function | get (in obj) |
Retrieve the signal. | |
function | getRaw (in obj) |
Retrieve raw waveform. Use with caution. | |
function | getScaled (in obj) |
Retrieve the signal with appropriate power scaling. More... | |
function | getNormalized (in obj) |
Retrieve the signal normalized to unity power. More... | |
function | normalize (in obj) |
Normalize stored signal to unity mean power. More... | |
function | plus (in obj1, in obj2) |
Add two signals (coherently) | |
function | truncate (in obj, in L) |
Truncate signal length. | |
function | combine (in varargin) |
Combine multiple signals. More... | |
function | disp (in obj) |
Overload display function. | |
function | set (in obj, in varargin) |
Set properties for the current object. More... | |
Protected Attributes | |
Property | Fc |
Carrier frequency (Hz) | |
Property | Fs |
Sampling rate (S/sec) | |
Property | Rs |
Symbol rate (Baud) | |
Property | P |
Total signal power (pwr object) | |
Property | PCol |
Signal power per column (array of pwr objects) | |
Property | E |
Complex baseband LxN (L = length, N = number of components) | |
Static Private Member Functions | |
static function | enforceLhs (in n, in minimum) |
Signal description class.
signal_interface contains main signal attributes: waveform, carrier frequency, sampling rate, symbol rate, and power. Only objects of type signal_interface can be passed between units.
The waveform can contain multiple components/columns - the idea being that a polarization multiplexed signal, e.g. could have 2 components/columns, one for each state of polarization. For multimode fiber, the definition would be analogous, there would just be more columns.
A number of operations are overwritten for signal_interface objects so that they can be treated like arrays containing waveforms (e.g. sig1+sig2 produces a result that makes sense). See methods for details.
Conventions
Power scaling Note that both the waveform and the object's power property contain information about the waveform's amplitude. Generally, when these conflict, the information in the power property takes precedence.
Power can be specified either as a per-column/mode quantity or for the whole signal. When these conflict, the per-column specification takes precedence.
On construction, if power is not specified, it is calculated automatically from the waveform for each column separately. If total power but not per-column power is specified, the splitting fraction is calculated numerically from the waveform.
Example
will create a signal with random values, sampling rate 10G, no carrier frequency, symbol rate (nominal) 1G, and 3dBm power and 20 dB SNR (nominal). See also run_TestSignalInterface.m, run_TestSignalInterfaceAdvanced.m
Definition at line 58 of file signal_interface.m.
function signal_interface::signal_interface | ( | in | signal, |
in | param | ||
) |
Class constructor.
Constructs an object of type signal_interface. Example:
s1 is the waveform. Each column corresponds to a signal component - i.e. a polarization multiplexed signal would be an Lx2 array param is the signal parameters. For Fc, Fs, and Rs, there is a direct mapping to signal properties. Power can be specified either as total signal power or power per column (this will take precedence if both are specified). In case power is not specified, a warning will be displayed, and the total signal power will be calculated from the waveform.
function signal_interface::combine | ( | in | varargin | ) |
Combine multiple signals.
Like concatenation, but for signal_interface objects. All signal parameters must match (Rs, Fs, etc.) to avoid an error.
Example:
function signal_interface::end | ( | in | obj, |
in | k, | ||
in | n | ||
) |
Overload of indexing end statement.
k | Current dimension index |
n | Total number of dimensions |
function signal_interface::fun1 | ( | in | obj, |
in | fun | ||
) |
Apply a function to each signal component separately.
This allows the user to avoid for loops and/or repmat if the same operation is being performed on all modes independently.
It should run faster than an implementation based on for loops/repmat, occupy fewer lines of code, and take less memory. It also automatically tracks changes in power, which can be useful for, e.g. filtering operations.
Examples
Or for more complicated functions where top-down programming is required:
See also Matlab's bsxfun and arrayfun for examples
function signal_interface::getNormalized | ( | in | obj | ) |
Retrieve the signal normalized to unity power.
Normalize then return signal
function signal_interface::getScaled | ( | in | obj | ) |
Retrieve the signal with appropriate power scaling.
Retrieve the signal with appropriate power scaling. Scaling is applied based on the per-column signal power
function signal_interface::normalize | ( | in | obj | ) |
Normalize stored signal to unity mean power.
Normalize the stored signal to unity power. Normalization is based on the total signal power (same scaling is applied to all signal components) Since we mostly use this for DSP, stored power is changed to track new value so that get returns desired, normalized field.
function signal_interface::params | ( | in | obj | ) |
Returns signal parameters in a struct.
This allows easily use and manipulate the parameters to construct a signal_interface derived from the existing one.
p | Structure containing the signal necessary parameters |
function signal_interface::set | ( | in | obj, |
in | varargin | ||
) |
Set properties for the current object.
Examples:
The first two lines are equivalent, and just show the different main syntax that can be used. They will set the signal to 100 1's without changing other properties. The next two lines are examples of how to change multiple properties at once.
Note on power specfication: If both P and PCol are set, values in PCol take precedence.
obj | signal_interface with changed properties |
function signal_interface::subsref | ( | in | obj, |
in | s | ||
) |
Overload indexing access for read the field.
Allows to access the internal field with the the standard MATLAB indexing system.
Example
If sig is a signal_interface you can access the field as sig(:,1)