MATLAB: How to obtain parameters K’ and tau in transfer function G2

'transfer function' 'control system toolbox'

I have a transfer function and I need to approximate it for another which is simpler, a linear one. So I have:
U1=[K K*c];
D1=[1 p];
D11=[1 2*delta*w w^2];
D1=D1*D11;
G1=tf(N1,1);
U2=[K'];
D2=[tau 1];
G2=tf[U2,D2];
G1 is the complex transfer function and G2 is the simple transfer function. The coefficients in G1 are known, but K' and tau in G2 are unknown and I have to find them according to the response I receive from y1's graph (y1 stands for the output due to an input, which is a step function, and to the transfer function G1). How can I determine K' and tau?
PS: For y1 I've used:
t=[0:0.0001:20];
y1=step(t,G1);
plot(t,y1);
title('Output')
xlabel('Time (seconds)')
ylabel('y1')

Best Answer

Dear Ricardo,
I wrote a matlab code for you (edited from this Mathworks example ) which could help you further:
clc;clear all;close all;
mass = 1; spring = 10; damping = 2;
num_orig = 1;
den_orig = [mass damping spring]; %order of tf is now 2
h_orig = tf(num_orig,den_orig) % this is the original transfer function
[sys,g] = balreal(h_orig); % balanced state-space realization
h_simpl = modred(sys,2,'MatchDC'); % simplified balanced state-space realization
[num_simpl,den_simpl] = ss2tf(h_simpl.a,h_simpl.b,h_simpl.c,h_simpl.d);
h_simpl = tf(num_simpl,den_simpl) % simplified transfer function
figure(1)
step(h_orig,'-r'); hold on
step(h_simpl,'-b'); hold off
legend('step response, original transfer function','step response, simplified transfer function','Location','northoutside')
If you modify if for your own code, a crititcal point is the second input argument of the modred function .
Good luck! Christiaan