I have the following step response of a closed loop system. Using the calculations below, I tried to calculate the transfer function. I am trying to get the same response in Matlab. However, I seem not get it right. Can someone please tell me what I am doing wrong? My result in Matlab as well is given below.
You should not do
T = feedback(H,1), just do
The output you have is already the result of the whole system (the whole closed-loop system, not the plant that will then have a feedback), so you should just do
step(H) and you will get something similar to the oscilloscope measurement. In order to further break down the identification into what is the behavior of the controller and what is the behavior of the plant you would need more measurements.
Also, as Marko Buršič mentioned, the system is nonlinear and your approximation will not look\behave exactly as the original system. But I would not go as far as he did in saying that "you can't estimate it with 2nd order linear system". In many cases you can get away with approximating nonlinear systems with some 1st, 2nd or Nth order transfer function. But it will be up to you to evaluate if that 2nd order TF will be enough for your problem.