# Characterising a system from its input and output

I have 2 data sets sampled at regular intervals which represent the input and the output of a system. A quick analysis of the plots shows the following:

• There is a proportional factor between the input and the output.
• There is a delay before a change in the input is observable in the output. This delay depends on the scale of the change: larger changes in the input are observable in the output after a longer delay than smaller changes in the input.

I would like to approximate the system with a function, but I am novice in signal processing and I have no idea how to get started. I don't even know if this is a solvable problem. Any idea? I am comfortable using Matlab/Octave, and computer programming in general.

I can get more data from the system if required, but I cannot control the input. This is because the system is only observable when a PID controller keeps it stable.

## 1 Answer

Use the matlab cpsd (cross power spectral density) function on your two signals.
That will give you the frequency response.
Do an xcorr (cross correlation) to find the time delay between the two signals.
Do this for several pairs of input and output files and see if the results match between different pairs.
If they are (reasonably) similar then you could create an FIR filter that reproduces the frequency response and delay.

You could then apply the filter to a set of input data to approximate the expected output.

If there is a PID controller in the middle, however, I don't know if this procedure will be enough.

• Thanks for your answer. I will give it a go later. The PID should not be a problem: my input data set is not the PID input but the PID output, which is the system input. – marcv81 Sep 25 '14 at 10:36
• I had a chance to test your suggestions. In order to scale the data sets I divided them by their RMS. xcorr was awesome to find the delay between the signals: I got very similar results for different pairs and I now think the delay is independent from the amplitude of the change. I did not understand how to use cspd: could you please elaborate on what I am expecting to get from that function? I have not tried to define a FIR filter, but it is quite clear what I would have to do here. Thanks again! – marcv81 Oct 7 '14 at 11:02
• The psd shows you the frequencies present in the signal. The cpsd shows you the difference in the frequency content between the two signals. If you do a cpsd of the input to a simple low pass filter and the output of the filter, then the plot shows you the frequency response of the filter. If you use it that way on your input/output signals, you can see the frequency response of your system. From that you can generate a FIR that duplicates the response. – JRE Oct 7 '14 at 11:11