What I understand from your question is:
You have a MIMO system which has P inputs and Q outputs. You have all the possible impulse responses corresponding to input-output pair.You want to apply different inputs to the system and observe the outputs "Q". instead of manually changing the inputs each time and running the simulation again, you want to automate the process.
For any system, its input and output ports are fixed. As you mentioned that there are a variable number of inputs, I understand that some input ports may not receive any signal, resulting in a zero input.
Let us consider that you want to apply signals as per you specifications at some of the input ports. But, manualy changing the input signal each time and running the simulation again and again is not preferable.
In order to overcome this, I will suggest the following workaround:
Define the input signals as a functioon of time in Command window. Run the simulink model directly from the command window using the command "sim". This will enable you to run the model multiple times by taking different combinations of input signals.
Follow the below given steps to implement the workaround:
- In the base workspace, define a variable "t" which is an array of timesteps taken by the simulation.
- Suppose that the system has input ports P1, P2, P3, P4 and P5
- Suppose that the system has output ports Q1 and Q2. As mentioned in the question, you have information regarding all the possible impulse responses. Therefore you can calculate Q1 from the given input signal.
- Define the input signals as function of time (t) as per your specifications in the base workspace. For example, suppose that you want to apply input signals only at the ports P1 and P3. Define them as function of "t". Set all the remaining input signals corresponding to the other input ports to zero.
t = 0:time_step:simulation_time;
Output_Q1=zeros(length(t),n);
Output_Q2=zeros(length(t),n);
out=sim('Simulink_model_name');
Output_Q1(:,1)=out.yout{1}.Values.Data;
Output_Q2(:,1)=out.yout{2}.Values.Data;
out=sim('Simulink_model_name');
Output_Q1(:,2)=out.yout{1}.Values.Data;
Output_Q2(:,2)=out.yout{2}.Values.Data;
out=sim('Simulink_model_name');
Output_Q1(:,1)=out.yout{1}.Values.Data;
Output_Q2(:,1)=out.yout{2}.Values.Data;
- Using the impulse responses, organize your MIMO system into a subsystem as depicted in the figure. Utilize Simulink's "Inport" and "Outport" blocks to input signals from the workspace into the system and export the system's output back to the workspace.
- Open the "configuration properties" by pressing "Ctrl+E". Navigate to the "Data Import/Export" tab and make the below given changes:
- Now navigate to the "Solver" tab and make the following changes:
- After making the above changes, save the simulink madel and you may close it.
- Run the aboove attached matlab script. It will run the simulation three times. Each time it will take a different combination of inputs. It will store the result of each iteration in 2d arrays named "Output_Q1" and "Output_Q2".
I hope you find the information useful !!