First, define the four matrices for each model, then use parallel() to connect the two systems in parallel, and finally call step() to test the system’s output curve.
%% Example of connecting two state space systems in parallel
%% parallel()
%%%%%%%%%%%
clear all;
clc;
close all;
%%%%%%%%%%%%%
%%% System 1
A1=[-1.1 -1.3;
0.5 -1.5];
B1=[1;0];
C1=[1.2 1.4];
D1=[0.6];
%%% System 2
A2=[-1.3 0.4;
-1.5 -1.8];
B2=[0;1];
C2=[1.2 0.4];
D2=[0.4];
[A3,B3,C3,D3]=parallel(A1,B1,C1,D1,A2,B2,C2,D2);
sys3=ss(A3,B3,C3,D3);
t1=0:0.01:40;
[y3,t3]=step(sys3,t1);
figure(1);
plot(t3,y3,’b-‘);
title(‘Parallel Output’);
xlabel(‘t(s)’);
ylabel(‘y’);
legend(‘Parallel Output’);
grid on;
grid on;
%%%%
disp(‘End.’);