[edit: Fix a typo in the y-axis label of two plots.]
[edit: Fix mistake in equation - thank you @Paul.] You and @Paul are skilled in using Mat;lab's tools for modeling and system identificaiton. I am impressed. @Paul gave a very nice compact demonstration that tfest() was not able to obtain a reasonable estimate of the system transfer function, when using time domain data from an unstable system, but tfest() was able to obtain a very good estimate of the transfer function when using ideal frequency domain data. @Paul also showed that the frequency domain estimate of the transfer function, generated by tfestimate() using the time domain data, was very inaccurate. Therefore we all wonder what could be done to get better esitmates.
@Paul generated a chirp signal which varied from 0.016 to 16 Hz over 10 seconds. Since the system is unstable, I wonder if the output does anything really wierd, so let's inspect it: h = tf([0.5 3],[1 2.5 -10]);
u1 = chirp(t,f0,t(end),f1);
subplot(311), plot(t,u1,'-r'); grid on; ylabel('u1(t)')
subplot(312), plot(t,y1,'-r'); grid on; ylabel('y1(t)')
subplot(313), semilogy(t,y1,'-r'); xlabel('Time (s)'); ylabel('y1(t)'); grid on
The plots above show that the output, y1(t), never oscillates, despite the oscillatory input, and it grows exponentially (linear, on a semi-log plot) from t=1 to the end. It is therefore not suprising that we cannot use this time domain data to get a good estimate of the transfer function.
Would we do any better with a white noise input? I doubt it, but let's try.
u2 = rand(1,length(t))-0.5;
subplot(311), plot(t,u2,'-r'); grid on; ylabel('u2(t)')
subplot(312), plot(t,y2,'-r'); grid on; ylabel('y2(t)')
subplot(313), semilogy(t,y2,'-r'); grid on; ylabel('y2(t)'); xlabel('Time (s)')
The output is not much different with white noise input than it was with a cirp input. With white noise, the output takes a little longer to start its exponential growth phase.
By the way, here is a pole-zero plot:
The denominator polynomial
factors to
, which means the unstable pole is associated with the frequency 2.15 rad/s = 0.34 Hz. What if we keep the input below this frequency? subplot(311), plot(t,u3,'-r'); grid on; ylabel('u3(t)')
subplot(312), plot(t,y3,'-r'); grid on; ylabel('y3(t)')
subplot(313), semilogy(t,y3,'-r'); grid on; ylabel('y3(t)'); xlabel('Time (s)')
Warning: Negative data ignored
Even in this case, the output grows exponentially. One explanation for this result is that any abrupt transient contains high frequencies. In the case above, there is a sharp transient from zero activity before t=0 to a sine wave after t=0. The high frequencies in that transient are enough to excite the unstable mode of the system.