Search code examples
matlabsimulinkbus

How to implement math operations to bus signal MATLAB


I work in Simulink and have bus signal (now it consists of 11 signals, every signals is a vector). And I want to make some operations on this bus. It means to make the same operations at each of this 11 signals included in Bus. I tried this way: My subsystem

Just implement all my functions and operations at whole Bus. And some blocks (for example, Zero-Order Hold) works fine (it implements correctly to all it's signals). but next block - integrator - works fine (it really integrate all signals) but that crashes my Bus! It returns one vector. It has size equal to the sum of all Bus's signals.

I know I can use Bus Selector block to create 11 parallel signals and copy all my operations for each of them.

How to get Bus signal in more efficient way?


I made it this way (don't attach it like an answer, because Corey Z give the answer at the same time):

enter image description here


Solution

  • Is there any reason that you don't want to convert your bus to a vector to put it through the integrator? enter image description here

    Each vector signal in the bus will be appended to a 1-dimensional vector signal. The vector will come out of the integrator in the same dimensions that it went in and then can be turned back into a bus if need be using the bus creator tool under the signal routing toolbox.

    On another note, it seems that you have some discrete time domain elements mixed into your block model along with your continuous-time integrator. If that gives you errors you may need to look into the Discrete-Time Integrator block.