I have written a MATLAB code to build a transfer function by interconnecting dynamic blocks. When I run the m-file, I get different step responses from the state-space model and its transfer function equivalent. The system is SISO type. May you advise?
Here is the code:
G_1 = tf([160], [1]); G_2 = tf([1], [1 1 0]); H = tf([1 0], [1]);G_1.InputName = 'e'; G_1.OutputName = 'gain_out';G_2.InputName = 'p_in'; G_2.OutputName = 'output';H.InputName = 'output'; H.OutputName = 'sense_out';sum1 = sumblk('e = input - output'); sum2 = sumblk('p_in = gain_out - sense_out');sys_ss = connect(G_1, G_2, H, sum1, sum2, 'input', 'output');[num den] = ss2tf(sys_ss.A, sys_ss.B, sys_ss.C, sys_ss.D); sys_tf = tf(num, den);step(sys_ss), grid on; figure; step(sys_tf), grid on;
Best Answer