メインコンテンツ

phased.CustomCascadeComponent

Custom cascade component

Since R2026a

Description

The phased.CustomCascadeComponent System object™ is used with the phased.Transmitter or phased.Receiver System objects to implement cascade configurations. Cascade configurations let you customize signal processing behavior. To enable a cascade configuration, set the property Configuration="Cascade" in the phased.Transmitter or phased.Receiver System objects.

To create and use a phased.CustomCascadeComponent System object:

  1. Create the phased.CustomCascadeComponent object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Use a phased.CustomCascadeComponent together with a phased.Transmitter and phased.Receiver System object to create cascade configurations. You can specify a behavior function, the number of input and output channels, and its name.

Creation

Description

component = phased.customCascadeComponent() creates a phased.CustomCascadeComponent System object, component.

example

component = phased.customCascadeComponent(Name=Value) creates a phased.CustomCascadeComponent System object component, with the specified property Name set to the specified Value. You can specify additional Name=Value arguments in any order as (Name1=Value1,...,NameN=ValueN).

component = phased.CustomCascadeComponent(fcn,nin,nout,Name=Value) creates a phased.CustomCascadeComponent, component, with the BehaviorFcn set to fcn, the NumInputChannels property set to nin, and the NumOutputChanels property set to nout.

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Behavior function for processing input data, specified as a function handle. The function handle defines custom behavior. The Input to the function handle is complex-valued N-by-M matrix, where N is the number of input samples and M is the number of input channels. The function handle outputs an L-by-P matrix, where L is the number of output samples and P is the number of output channels. The behavior function can have one multi-channel input and one multi-channel output.

The following code shows how to use the sum function over all columns of a matrix:

custom = phased.CustomCascadeComponent(BehaviorFcn=@(x)sum(x,2),2,1,ComponentName="Combiner");

Data Types: function_handle

Number of input channels, M, specified as a positive integer.

Data Types: double

Number of output channels. P, specified as a positive integer.

Data Types: double

Component name, specified as a string.

Example: "myComponent"

Data Types: char | string

Usage

Description

sigout = component(sigin) subjects the input signal sigin to the behavior function specified in the BehaviorFcn property.

example

Input Arguments

expand all

Input signals, specified as a N-by-M complex-valued matrix where N is the length of the input signals. M is the number of channels specified by the NumInputChannels property. (N, M) is the size of the input to the behavior function.

Data Types: single | double
Complex Number Support: Yes

Output Arguments

expand all

Output signals, specified as a L-by-P complex-valued matrix where L is the length of the output signals. P is the number of channels specified by the NumOutputChannels property. (L, P) is the size of the output of the behavior function.

Data Types: single | double
Complex Number Support: Yes

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

Use the phased.CustomCascadeComponent System object™ to compare additive white noise in a signal to additive pink noise. Pink noise is not evenly distributed across the power spectrum.

First, create an input signal of 10000 zeros to visualize the noise.

nSamples = 1e4;
in = zeros(nSamples,1);

Use the rf.Amplifier System object to add white noise.

amp = rf.Amplifier(IncludeNoise=true);
rx = phased.Receiver(Configuration="Cascade",Cascade={amp});
out = rx(in);

Display the white noise power spectrum.

pspectrum(out,Parent=axes(figure))

Figure contains an axes object. The axes object with title Fres = 0 . 0061331 times pi radians/sample, xlabel Normalized Frequency ( times pi radians/sample), ylabel Power Spectrum (dB) contains an object of type line.

Alternatively, use the phased.CustomCascadeComponent System object to add pink noise using a custom noise generator. Configure the System object to have one input channel and one output channel.

pn = dsp.ColoredNoise(Color="pink",SamplesPerFrame=nSamples);
custnoise = phased.CustomCascadeComponent(@(x)x+(pn()+pn()*1i), ...
   NumInputChannels=1,NumOutputChannels=1)
custnoise = 
  phased.CustomCascadeComponent with properties:

          BehaviorFcn: @(x)x+(pn()+pn()*1i)
     NumInputChannels: 1
    NumOutputChannels: 1
        ComponentName: "Custom"

rx = phased.Receiver(Configuration="Cascade",Cascade={custnoise});
out = rx(in);
viewLayout(rx)

Figure contains an axes object. The hidden axes object with title Receiver Layout contains 6 objects of type line, text.

Display the pink noise power spectrum.

pspectrum(out,Parent=axes(figure))

Figure contains an axes object. The axes object with title Fres = 0 . 0061331 times pi radians/sample, xlabel Normalized Frequency ( times pi radians/sample), ylabel Power Spectrum (dB) contains an object of type line.

Use a Butler Matrix within a cascade to create an analog beamforming network in which the antenna pattern depends on the input port.

Set up two-element Butler matrix

Model the transmitter as a mixer followed by Butler matrix followed by an amplifier.

mixer = rf.Mixer;
bmsize = 2;
butler = phased.CustomCascadeComponent( ...
    @(x)Butler2x2(x),bmsize,bmsize, ...
    ComponentName="Butler Matrix");
pa = rf.Amplifier(Gain=30);
tx = phased.Transmitter(Configuration="Cascade",Cascade={mixer,butler,pa});
viewLayout(tx)

Figure contains an axes object. The hidden axes object with title Transmitter Layout contains 22 objects of type line, text.

Set up two-element ULA

fc = 2.4e9;
ula = phased.ULA(NumElements=bmsize, ...
    ElementSpacing=freq2wavelen(fc)/2);
txAntenna = phased.Radiator(Sensor=ula, ...
    OperatingFrequency=fc);

We form the antenna pattern when a signal is injected into transmit channel one vs transmit channel two.

Steer Matrix

Plot pattern.

ax = axes(figure);
hold(ax,"on")
xlabel(ax,"Azimuth Angle")
ylabel(ax,"Response")
legend(ax)

Transmit a signal from each Tx port and visualize the antenna pattern.

txang = -90:90;
radAngles = [txang;zeros(1,length(txang))];
for i = 1:bmsize
    % Output only on a single channel
    sig = zeros(1,bmsize);
    sig(i) = 1i;

    % Propagate from -90 to 90
    txout = tx(sig);
    radout = txAntenna(txout,radAngles);
    plot(ax,txang,abs(radout),DisplayName=['Antenna Pattern Channel ',num2str(i)]);
end

Figure contains an axes object. The axes object with xlabel Azimuth Angle, ylabel Response contains 2 objects of type line. These objects represent Antenna Pattern Channel 1, Antenna Pattern Channel 2.

Create a 2-by-2 Butler Matrix and apply Butler Matrix weights.

function y = Butler2x2(x)
weights = [0 -pi/2;
    -pi/2 0];
y = x*exp(1i*weights);
end

Use a custom cascade component to model heterogeneous behavior between channels. Show how to apply uncorrelated phase noise between channels with a custom component and an array of rf.Mixer System objects. When setting up a transmitter as a cascade of mixers and amplifiers, the phase noise between channels is correlated.

Create correlated phased noise

Create two-channel input signal and components.

nchannel = 2;
in = ones(100,nchannel);
mixer = rf.Mixer(IncludePhaseNoise=true);
amp = rf.Amplifier(Gain=10);
tx = phased.Transmitter(Configuration="Cascade", ...
    Cascade={mixer,amp});

Show that phase noise is correlated by showing that the phase noise is identical in both channels.

out = tx(in);
plotPhaseNoise(out)

Figure contains an axes object. The axes object with title Signal Phase, xlabel Samples, ylabel Phase contains 2 objects of type line. These objects represent Channel 1, Channel 2.

Set up array of parallel mixers

We can use the custom object to model uncorrelated phase noise by setting up an array of mixers in parallel in a custom cascade.

mixers = arrayfun(@(x)rf.Mixer(IncludePhaseNoise=true), ...
    1:nchannel,UniformOutput=false);
customMixer = phased.CustomCascadeComponent( ...
    @(x)mixSignals(x,mixers),nchannel,nchannel, ...
    ComponentName="Custom Mixer");
amp = rf.Amplifier(Gain=10);
tx = phased.Transmitter(Configuration="Cascade", ...
    Cascade={customMixer,amp});

Show the transmitter layout.

viewLayout(tx,Parent=axes(figure))

Figure contains an axes object. The hidden axes object with title Transmitter Layout contains 14 objects of type line, text.

Plot the uncorrelated phase noise.

out = tx(in);
plotPhaseNoise(out)

Figure contains an axes object. The axes object with title Signal Phase, xlabel Samples, ylabel Phase contains 2 objects of type line. These objects represent Channel 1, Channel 2.

Auxiliary functions

function y = mixSignals(x,mixers)
nmix = length(mixers);
y = zeros(size(x,1),nmix);
for imix = 1:nmix
    y(:,imix) = mixers{imix}.step(x(:,imix));
end
end

function plotPhaseNoise(out)
ax = axes(figure);
hold(ax,"on")
nchannel = size(out,2);
for iChannel = 1:nchannel
    plot(ax,angle(out(:,iChannel)), ...
        DisplayName=['Channel ', ...
        num2str(iChannel)])
end
ylabel(ax,"Phase")
xlabel(ax,"Samples")
title(ax,"Signal Phase")
legend(ax)
end

Version History

Introduced in R2026a