Main Content

parallel

Parallel connection of two models

    Description

    sys = parallel(sys1,sys2) forms the parallel interconnection of two dynamic system models by connecting the same input signals to sys1 and sys2 and summing the outputs, as shown in the diagram.

    This command is equivalent to the direct multiplication sys = sys1 + sys2. For MIMO systems, sys2 and sys2 must have the same number of inputs and outputs.

    example

    sys = parallel(sys1,sys2,in1,in2,out1,out2) forms the more general parallel interconnection shown in the following diagram.

    The vectors in1 and 1n2 contain indices to the inputs of sys1 and sys2 that receive the inputs u. Similarly, out1 and out2 are vectors specifying the outputs of sys1 and sys2 that sum to form the outputs y. The resulting sys has inputs [v1,u,v2], where v1 and v2 are the inputs not specified in in1 and 1n2. Similarly sys has outputs [z1,y,z2], where z1 and z2 are the outputs not specified in out1 and out2.

    example

    sys = parallel(sys1,sys2,"name") connects a sys1 and sys2 by matching signal names as defined in the OutputName and InputName properties of the models. Inputs with matching names are connected and outputs with matching names are summed.

    example

    Examples

    collapse all

    Create two SISO systems, one a state-space model and the other a transfer function.

    sys1 = rss(3);
    sys2 = tf(1,[1 1 1]);

    Form the parallel interconnection of the two systems and examine the resulting model.

    sys = parallel(sys1,sys2);
    size(sys)
    State-space model with 1 outputs, 1 inputs, and 5 states.
    

    Connecting a transfer function with a state-space model results in another state-space model. For more information about the results of combining different model types, see Rules That Determine Model Type.

    The parallel interconnection is equivalent to the arithmetic sum of the two models. Check this equivalence by examining the frequency responses.

    sysa = sys1 + sys2;
    bodeplot(sys,'-',sysa,'--')

    MATLAB figure

    Connect two MIMO systems in parallel. When the two systems have the same input-output dimensions, you can connect all inputs and outputs. For instance, create two three-output, two-input systems and form such an interconnection.

    sys1 = rss(4,3,2);
    sys2 = rss(4,3,2);
    sys = parallel(sys1,sys2);

    The resulting model has the same input-output dimensions.

    size(sys)
    State-space model with 3 outputs, 2 inputs, and 8 states.
    

    You can form parallel connections by assigning matching names to the signals you want to connect. Starting with the three-output, four-input system sys1 and the two-output, three-input system sys2, form the parallel connection shown in the diagram.

    Create state-space models of the two systems and name the input and output signals.

    % sys1: 3-output, 4-input
    sys1 = rss(4,3,4);
    sys1.InputName = ["in1a","in1b","in1c","in1d"];
    sys1.OutputName = ["out1a","out1b","out1c"];
    % sys2: 2-output, 3-input
    sys2 = rss(3,2,3);
    sys2.InputName = ["in2a","in2b","in2c"];
    sys2.OutputName = ["out2a","out2b"];

    In the interconnection shown in the diagram, inputs 2 and 3 of sys1 connect to inputs 1 and 2 of sys2, respectively. The diagram also shows that the second output of sys1 sums with the first output of sys2. Change the signal names so that the names of connecting signals match.

    sys1.InputName = ["in1a","u1","u2","in1d"];
    sys1.OutputName = ["out1a","y1","out1c"];
    sys2.InputName = ["u1","u2","in2c"];
    sys2.OutputName = ["y1","out2b"];

    Form the connection using the name flag.

    sys = parallel(sys1,sys2,"name");

    Examine the dimensions, inputs, and outputs of sys to confirm that the connections match the ones in the diagram.

    size(sys)
    State-space model with 4 outputs, 5 inputs, and 7 states.
    
    sys.InputName
    ans = 5×1 cell
        {'in1a'}
        {'in1d'}
        {'u1'  }
        {'u2'  }
        {'in2c'}
    
    
    sys.OutputName
    ans = 4×1 cell
        {'out1a'}
        {'out1c'}
        {'y1'   }
        {'out2b'}
    
    

    You can form parallel interconnections using a subset of model inputs and outputs by specifying the indices of the signals you wish to connect. Starting with the three-output, four-input system sys1 and the two-output, three-input system sys2, form the parallel connection shown in the diagram.

    Create state-space models of the two systems.

    % sys1: 3-output, 4-input
    sys1 = rss(4,3,4);
    % sys2: 2-output, 3-input
    sys2 = rss(3,2,3);

    To form the interconnection, create vectors that specify the inputs and outputs of each model to connect. For instance, as shown in the diagram, inputs 2 and 3 of sys1 connect to inputs 1 and 2 of sys2, respectively. Therefore, specify the input indices as follows.

    inp1 = [2 3];  % indices of in1b and in1c
    inp2 = [1 2];  % indices of in2a and in2b

    The diagram also shows that the second output of sys1 sums with the first output of sys2.

    out1 = [2];  % index of out1b
    out2 = [1];  % index of out2a

    Use these values to form the parallel interconnection.

    sys = parallel(sys1,sys2,inp1,inp2,out1,out2);

    The resulting model has four outputs and five inputs, as expected.

    size(sys)
    State-space model with 4 outputs, 5 inputs, and 7 states.
    

    Input Arguments

    collapse all

    Systems to connect, specified as a SISO or MIMO dynamic system model, control design block, or array of dynamic system models. Models and blocks that you can connect include:

    • Any numeric LTI model object, such as a tf, zpk, ss, frd, or pid model object.

    • A generalized or uncertain LTI model, such as a genss, genfrd, uss (Robust Control Toolbox), and ufrd (Robust Control Toolbox) model.

    • A control design block representing a tunable or uncertain block-diagram element, such as a tunablePID, tunableSS, tunableGain, tunableTF, tunableSurface, ultidyn (Robust Control Toolbox), or umargin (Robust Control Toolbox) block.

    • An AnalysisPoint block representing a location in the block diagram at which you want to extract system responses.

    • A summing junction that you create using sumblk.

    • An identified LTI model, such as an idtf (System Identification Toolbox), idss (System Identification Toolbox), or idproc (System Identification Toolbox) model.

    • A sparse model, represented by a sparss or mechss model object.

    • A time-varying or parameter-varying model, represented by an ltvss or lpvss model object.

    sys1 and sys2 must be both continuous, or both discrete with the same sample time.

    Inputs of sys1 and sys2 to connect, specified as vectors of indices. For instance, if you want to send the same input to the first input of sys1 and the second input of sys2, the second input of sys1 and the third input of sys2, and the third input of sys1 and the fifth input of sys2, set in2 = [1,2,3] and in2 = [2,3,5].

    Outputs of sys1 and sys2 to sum, specified as a vector of indices. For instance, if you want to sum the first output of sys1 with the second output of sys2, the second output of sys1 with the third output of sys2, and the third output of sys1 with the fifth output of sys2, set in2 = [1,2,3] and in2 = [2,3,5].

    Output Arguments

    collapse all

    Interconnected system, returned as a dynamic system model. The type of dynamic system model depends on the types of the connected systems sys1 and sys2. For example,

    • If one of the connected systems is an ss model and the other is a numeric LTI model other than an frd model, then sys is an ss model.

    • If one of the connected systems is an frd model and the other is a numeric LTI model, then sys is an frd model. If both systems are frd models, the frequency vectors must match.

    • If one of the connected systems is an identified LTI model, then sys is also an identified model.

    • If one of the connected systems is a generalized LTI model such as a genss or uss model, then sys is also a generalized LTI model.

    • If one of the connected systems is a sparse model, then sys is also a sparse model.

    If sys1 and sys2 are model arrays, then sys is a model array of the same size. Each entry in sys is the model formed by connecting the corresponding entries of the input arrays.

    Version History

    Introduced before R2006a