1
votes

Background: I have a complex mechanical oscillation system. With analogies I transformed it into an electrical circuit (every element is a RLC-oscillator). The only way to calculate the circuit is nodal analysis and it's too complex to do it by hand.

As the Symbolic Math Toolbox and the SimPowerSystems toolbox is not available, there is no convenient way to calculate the transfer function G(s) to use the transfer function block.

So I thought about using custom functions, but after consulting the documentation I'm still quite helpless. I hope to find some initial thoughts here.

My system can by described by the matrix equation:

A*x = y

where A is a 8x8 Matrix containing the RLC-impedances of my circuit, so basically every element is a polynomial Z(s) e.g. Z_11(s) = (s^1+2s^0)/(s^2+3s-s^-1) where s is the laplace-domain variable. The vector x is a 8x1 row vector containing my 8 scalar outputs. And y is a 8x1 row vector whose elements are either one of my 4 input signals or 0.

Finally I need a Simulink block with 4 inputs and 8 outputs which solves the linear equation system with s as variable.

Alternative I could imagine to use 4 blocks with just one input each (setting the other inputs to ´zero`) and superpose them. The selection of just one output is thinkable also.

Is there any way to implement this? How can I create a block, which works in the Laplace-Domain and not in the time-domain?

2

2 Answers

1
votes

You can use 4 Transfer Function (SISO) blocks as you suggested, but for a MIMO system such as yours, I would advise you to convert your system to or re-write it as a state-space representation and use a State-Space block instead.

1
votes

The n x n system matrix needs to be defined with transfer functions:

W = minreal( [  tf( ... ) ... tf(...) ; ... ; tf( ... ) ... tf(...)  ];

e.g.:

Z_11(s) = (s^1+2s^0)/(s^2+3s-s^-1)

->

Z_11 = tf( [1 2 0] , [1 3 -1] );

Usually an inversion is necessary

H = inv(W);

This matrix can directly be included in the LTI-Sytem Block of the Control System Toolbox. The input and output vectors are embedded using mux and demux.

Internally the LTI system is using n*n of the proposed state space models, therefore it would be to complicated for big system to create them manually.