Currently I try to understand an unknown mechatronic system. I used white noise as an input signal and measured the output of the system. Then I estimated a 2nd order transfer function (Output/Input) in the frequency domain using Matlab:
sys=Out/In
h = idfrd(sys, freq*2*pi, Ts);
np = 2;
nz = 2;
Gs = tfest(h, np, nz)
opts = c2dOptions('Method', 'tustin', 'PrewarpFrequency', 2*pi*120);
Gz = c2d(Gs, 1/4000, opts);
$$ Gs=\frac{3.765\cdot s^2 - 528.7 s - 5.113 \cdot 10^4}{s^2+183 \cdot s + 4.117 \cdot 10^5} $$
A bode Plot of the derived 2nd order system Gs (blue) and the measured data (orange) shows good alignment in amplitude and phase above 60Hz:
Further a pole-zero-plot of Gz shows that all poles are stable (inside unit circle of z-plane), but that there is one zero outside of unit circle of the z-plane:
Now I want to counteract the behaviour of the mechatronic system in a way that I achieve a unity output. So by modifying the input to the system I want to basically get rid of the system characteristics and achieve a pure unit transfer behaviour.
IGz=1/Gz; % so that IGz * Gz = 1
Mathematically I need to multiplicate the input signal with the inverse transform of the system. Here a bode plot of the system Gs (blue) and its inverse transform IGz (orange) basically shows what I want to do:
But because of the zero outside the unit circle the inverse transfer function now has a pole outside the unit circle and thus is unstable. Therefor I wonder how can I counteract the behaviour of the system while not getting an unstable system?
So far I have tried to replace the unstable pole by reflecting the pole inside the unit circle like it is advised here: $(z-p)$ by $(z-1/p)$ (as the unstable pole is purely real I don't need to do the complex conjungate). This keeps the amplitude response, but changes the phase response (blue: unstable IGz, orange: stabilized IGz):
However I would like to keep the phase response as closely to my inverse transfer function as well. But as I don't care so much about what happens below 60 Hz I wonder if there is an approximation of my inverse system which is good above ~60Hz in amplitude and in phase, but can deviate below ~60Hz and is stable. I wonder if there is an established way how one would derive such a system? Here is what I have tried so far:
pIG=pole(IGz);
zIG=zero(IGz);
z=tf('z',1/4000);
Test=((z-zIG(1))*(z-zIG(2)))/((z-1/pIG(1))*(z-pIG(2)));
Fac=evalfr(IGz,100)/evalfr(Test,100);
Test1=Fac*Test;
bode(IGz,Test1)
The result looks good at higher frequencies, however the phase could be better below 100Hz or so (blue: unstable IGz, orange: stabilised IGz with phase kept roughly the same above 100Hz):
Edit
I just looked at the impulse responses. The system $Gs$ of course is oscillationg, but decaying:
However the impulse response of the inverse system is instable of course:
The Impulse Response of the 2nd stabilized system is still overshooting with high amplitude. I wonder if this works, as I of course am limited in output with my controller:
With my Input u to the controller and the output y I want to do the following: u -> IGz (controller) -> y -> Gz (mechatronic system) -> y2 During all this the output y of the controller can't get too big. And it should be: y2/u=1
How can I best come up with a IGz that achieves this.