# Superposition in state space equation with multiple harmonics in the inputs

I have a question related to the superposition in state space equation. Suppose I have a state space equation below $$$$\frac{d}{dt}X = AX + B\begin{bmatrix} u_1(t)\\ u_2(t) \\ \end{bmatrix}$$$$ where X is the state vector, A, B are constant matrixes. u is the input time varying signals.

Now assume u can be expressed as $$$$u_1(t) = c_1\cos(w_1t)+c_2\cos(w_2t)\\ u_2(t) = d_1\cos(w_1t)+d_2\cos(w_2t)\\$$$$ where c1, c2, d1, d2 are constant coefficients, and w1 and w2 are different.

Can I rewrite the state space equation into the following two equations: $$$$\frac{d}{dt}X_1 = AX_1 + B\begin{bmatrix} c_1\cos(w_1t)\\ d_1\cos(w_1t) \\ \end{bmatrix}$$$$ and $$$$\frac{d}{dt}X_2 = AX_2 + B\begin{bmatrix} c_2\cos(w_2t)\\ d_2\cos(w_2t) \\ \end{bmatrix}$$$$

And then I solve for time-domain steady state expression for X1 and X2. The final time domain expression for X would be $$$$X = X_1+X_2$$$$

Is there anything wrong with this method?

This approach is completely reasonable, and is the obvious way of analyzing such a system. The equivalency can be show algebraically by expanding out the equation.

The simplest way of showing this is to use a Laplace-transform. If you are unfamiliar with this transform, the only thing you need to to follow this is that it is linear, it is written as $$\mathcal{L}\{u(t)\},$$ and it transforms derivation to multiplication with the variable s.

You have the equation

$$$$\frac{d}{dt}X = AX + B \begin{bmatrix} u_1(t)\\ u_2(t) \\ \end{bmatrix}$$$$

Taking the Laplace-transform of each side yields

$$$$sX = AX + B \begin{bmatrix} \mathcal{L}\{u_1(t)\}\\ \mathcal{L}\{u_2(t)\} \\ \end{bmatrix}$$$$

Manipulating this algebraically, we can show that $$$$X = (s\mathbb{I}-A)^{-1}B \begin{bmatrix} \mathcal{L}\{u_1(t)\}\\ \mathcal{L}\{u_2(t)\} \\ \end{bmatrix} = h(s)\begin{bmatrix} \mathcal{L}\{u_1(t)\}\\ \mathcal{L}\{u_2(t)\} \\ \end{bmatrix}$$$$

(where the funky "I" represents the identity matrix,and I have collected all the matrices into one function, h(s), which is called the transfer-function).

From here, we can separate the input signals into their two frequency-components: $$$$X = h(s)\begin{bmatrix} \mathcal{L}\{c_1 \cos(w_1 t) + c_2 \cos(w_2 t)\} \\ \mathcal{L}\{d_2 \cos(w_1 t) + d_2 \ cos(w_2 t)\} \\ \end{bmatrix} =$$$$ $$$$h(s)\begin{bmatrix} \mathcal{L}\{c_1 \cos(w_1 t)\} \\ \mathcal{L}\{d_2 \cos(w_1 t)\} \\ \end{bmatrix}+ h(s)\begin{bmatrix} \mathcal{L}\{c_2 \cos(w_2 t)\} \\ \mathcal{L}\{d_2 \ cos(w_2 t)\} \\ \end{bmatrix}$$$$

Here we can see that X is now written as the sum of two parts:

$$$$X_1 = h(s)\begin{bmatrix} \mathcal{L}\{c_1 \cos(w_1 t)\} \\ \mathcal{L}\{d_1 \ cos(w_1 t)\} \\ \end{bmatrix}$$$$

$$$$X_2 = h(s)\begin{bmatrix} \mathcal{L}\{c_2 \cos(w_2 t)\} \\ \mathcal{L}\{d_2 \ cos(w_2 t)\} \\ \end{bmatrix}$$$$

Each of these can now be reverse-transformed back into the time-domain to give two systems that you can analyze separately:

$$$$X_n = h(s) \begin{bmatrix} \mathcal{L}\{c_n \cos(w_n t)\} \\ \mathcal{L}\{d_n \ cos(w_n t)\} \\ \end{bmatrix} = (s\mathbb{I}-A)^{-1}B \begin{bmatrix} \mathcal{L}\{c_n \cos(w_n t)\} \\ \mathcal{L}\{d_n \ cos(w_n t)\} \\ \end{bmatrix}$$$$

$$$$\implies sX_n = AX_n + B \begin{bmatrix} \mathcal{L}\{c_n \cos(w_n t)\} \\ \mathcal{L}\{d_n \ cos(w_n t)\} \\ \end{bmatrix}$$$$

$$$$\implies \frac{d}{dt}X_n = AX_n + B \begin{bmatrix} c_n \cos(w_n t) \\ d_n \ cos(w_n t) \\ \end{bmatrix},$$$$

and we can see that this is identical to your proposed partitioning.

• How does $cos(\omega t)$ become $cos(\omega s)$? And how can two matrices be divided?
– Chu
Commented Jun 7, 2022 at 11:11
• It doesn't, and they can't (in general). I made a couple of pretty big errors initially, so thanks for pointing this out. I've edited the answer to correct these errors. 1) I wrote the time-domain expression for the input and just replaced t with s, which is very wrong. I've now simply included the Laplace-operator throughout. 2) I used a fraction as a shorthand for multiplying by the inverse of a matrix. This disregards the non-commutative nature of matrix-multiplication, so it isn't a good way of writing it. I've corrected this to the accurate inverse-multiplication. Commented Jun 7, 2022 at 11:52

Yes, you are totally fine for going that way. To prove the correctness, instead of going through messy computations like the other answer, you only need to keep in mind a very fundamental math concept that both differential and linear transform (matrix multiplication in your case) are linear operators. Using either concept will lead you the path.

With the fact that linear transformation is a linear operator, you will have the followings \begin{align} \frac{d}{dt}X_1+\frac{d}{dt}X_2 &=\left(AX_1+B\begin{bmatrix}c_1\cos{\omega_1t}\\ d_1\cos{\omega_1t}\end{bmatrix}\right)+ \left(AX_2+B\begin{bmatrix}c_2\cos{\omega_2t}\\ d_2\cos{\omega_2t}\end{bmatrix}\right) \\ &=AX_1+AX_2+B\begin{bmatrix}c_1\cos{\omega_1t}\\ d_1\cos{\omega_1t}\end{bmatrix}+B\begin{bmatrix}c_2\cos{\omega_2t}\\ d_2\cos{\omega_2t}\end{bmatrix} \\ &= A(X_1+X_2) + B\left(\begin{bmatrix}c_1\cos{\omega_1t}\\ d_1\cos{\omega_1t}\end{bmatrix}+\begin{bmatrix}c_2\cos{\omega_2t}\\ d_2\cos{\omega_2t}\end{bmatrix}\right) \\ &= AX+B\begin{bmatrix}u_1(t) \\ u_2(t)\end{bmatrix} \\ &=\frac{d}{dt}X. \end{align}

Or a much easier way, using the fact that differential operator is linear, you will get $$\frac{d}{dt}X_1+\frac{d}{dt}X_2 = \frac{d}{dt}(X_1+X_2) = \frac{d}{dt}X.$$

And of course

1. The input signal doesn't have to be harmonic
2. You can sum up as many components as you want, it doesn't necessarily have to be 2