Help in System signal reconstruction

Discussion in 'Programmer's Corner' started by sytem_recon, Apr 21, 2009.

  1. sytem_recon

    Thread Starter Active Member

    Apr 21, 2009
    52
    0
    I have input data u(t) and output data y(t) of a system having 500 points. This is test data from a SISO system. I am trying to use MATLAB so that it take a vector of input data, output data, and a sample time and produce the frequency response of the system (magnitude and phase). After this i want to make transfer function for this. My objective is to reconstruct the input signal from my output or output from input. Actually i need reconstruction signal of my system and for that i think i will use that transfer function. i.e. in lsim.
    I did follwing in matalb:

    clc;
    clear
    all;
    t =0.4e-9*(1:1:500);
    ut = [-0.05,-0.04,-0.05,-0.05,0.02,-0.05,-0.05,0.08,-0.05,-0.05,-0.05,-0.02,0.02,0.02,-0.05,-0.05,-0.05,-0.05,-0.05,-0.05,0.02,-0.08,-0.05,0.08,-0.05,0.02,0.05,0.02,0.08,0.08,0.02,-0.02,0.08,-0.05,0.02,-0.05,-0.08,0.02,0.02,0.08,-0.11,0.05,-0.05,0.08,0.08,0.08,0.02,-0.05,0.02,0.02,0.02,-0.02,0.02,-0.05,0.08,-0.11,-0.02,0.02,0.02,-0.05,-0.11,-0.08,0.02,-0.11,0.02,-0.05,-0.02,-0.05,0.02,-0.05,-0.05,0.02,0.02,0.02,-0.11,-0.05,-0.08,0.02,-0.05,-0.05,-0.05,-0.02,0.14,-0.17,0.02,-0.05,-0.02,-0.05,-0.05,0.02,0.02,0.01,0.02,0.08,-0.05,0.02,-0.05,-0.05,0.08,0.08,0.08,-0.04,0.14,0.02,0.08,0.08,-0.02,-0.05,0.08,0.02,0.08,0.02,0.02,0.02,0.02,0.02,-0.02,0.02,0.02,0.02,-0.05,0.08,0.02,0.08,0.02,0.02,0.01,0.02,0.08,-0.05,0.02,0.04,0.02,0.02,0.02,0.02,0.02,0.02,0.08,0.02,-0.05,-0.08,-0.05,-0.05,-0.11,-0.05,0.05,-0.11,0.08,-0.05,-0.11,-0.02,0.08,0.02,-0.05,-0.05,-0.02,0.02,0.02,0.02,0.08,-0.02,0.08,0.08,-0.11,-0.05,0.02,0.08,-0.05,0.08,0.02,-0.05,0.08,-0.05,0.02,-0.05,0.05,0.02,-0.05,0.02,-0.05,0.01,0.02,-0.11,0.14,-0.05,-0.02,-0.05,0.02,0.02,0.02,-0.08,0.08,0.02,0.08,0.02,-0.02,0.02,-0.05,-0.05,-0.05,0.04,-0.05,0.02,0.02,-0.11,0.02,0.02,-0.05,-0.05,-0.05,0.05,0.02,-0.05,-0.11,-0.11,-0.02,-0.05,0.08,-0.05,-0.11,-0.08,0.02,0.02,0.02,-0.05,0.04,0.2,0.27,0.45,0.52,0.76,1.2,1.7,2.02,2.58,3.16,3.64,4.33,4.64,5.141,5.629,5.9535,6.266,6.454,6.766,6.883,7.08,7.27,7.2,7.2,7.33,7.33,7.2,7.39,7.27,7.3,7.33,7.2,7.2,7.14,7.05,6.829,6.641,6.391,5.9535,5.399,4.95,4.14,3.64,2.89,2.36,1.89,1.14,1.02,0.52,0.27,0.08,-0.11,-0.3,-0.55,-0.48,-0.55,-0.48,-0.55,-0.48,-0.46,-0.36,-0.36,-0.23,-0.3,-0.24,-0.17,-0.17,-0.11,-0.17,-0.14,-0.05,-0.05,-0.11,0.02,-0.05,-0.05,0.08,-0.05,0.08,0.04,0.08,0.14,0.08,0.14,0.2,0.27,0.27,0.33,0.27,0.3,0.33,0.2,0.33,0.33,0.36,0.33,0.27,0.27,0.2,0.24,0.08,0.14,0.27,0.14,0.11,0.14,0.02,0.08,0.02,0.02,0.02,0.08,0.02,-0.05,0.08,-0.05,0.02,0.08,-0.05,0.08,0.08,0.14,0.08,-0.05,-0.08,-0.11,-0.05,0.02,-0.05,-0.02,0.02,0.02,0.02,-0.05,-0.04,0.02,0.02,-0.05,0.02,-0.02,-0.05,-0.05,-0.11,-0.05,0.02,0.08,-0.11,0.02,-0.05,-0.02,-0.05,-0.05,0.08,-0.11,-0.02,0.08,-0.05,-0.05,0.02,-0.02,-0.05,0.08,0.02,-0.05,0.02,0.08,-0.11,0.08,-0.17,-0.05,-0.05,0.02,0.02,-0.11,0.02,-0.05,-0.05,0.02,-0.11,-0.02,0.02,-0.05,0.02,-0.05,-0.02,0.02,-0.05,-0.11,-0.05,-0.04,0.02,0.02,0.02,0.02,-0.01,-0.05,-0.05,-0.05,-0.05,-0.14,0.14,-0.05,0.02,-0.05,-0.08,0.02,-0.05,0.02,-0.11,-0.11,-0.11,-0.05,-0.05,-0.11,-0.02,-0.17,0.02,-0.05,0.02,-0.08,0.02,-0.05,-0.11,-0.05,-0.08,0.08,0.08,0.02,-0.05,0.02,0.02,-0.05,-0.05,-0.11,-0.05,0.02,0.08,-0.05,0.02,-0.02,0.08,-0.05,0.02,-0.05,-0.02,0.02,0.02,-0.11,-0.11,-0.05,0.08,-0.05,-0.05,-0.05,-0.05,0.08,0.02,0.08,0.02,0.05,0.02,-0.17,0.02,0.02,-0.02,0.02,-0.05,-0.11,-0.05,-0.02,-0.05,-0.05,-0.05;];
    yt = [0,0,0,0,0,0,0,0,0,0,0,0,-0.07,-0.07,-0.08,-0.07,-0.05,-0.07,-0.05,-0.08,-0.07,-0.05,-0.07,-0.08,-0.07,-0.07,-0.05,-0.06,-0.05,-0.05,-0.07,-0.05,-0.07,-0.07,-0.08,-0.05,-0.08,-0.07,-0.07,-0.08,-0.07,-0.05,-0.06,-0.07,-0.08,-0.07,-0.05,-0.08,-0.07,-0.08,-0.07,-0.07,-0.07,-0.07,-0.07,-0.08,-0.05,-0.07,-0.05,-0.08,-0.07,-0.07,-0.07,-0.05,-0.07,-0.08,-0.05,-0.07,-0.07,-0.07,-0.07,-0.05,-0.06,-0.07,-0.08,-0.05,-0.07,-0.07,-0.07,-0.08,-0.07,-0.07,-0.07,-0.07,-0.07,-0.07,-0.05,-0.07,-0.05,-0.03,-0.08,-0.05,-0.06,-0.05,-0.07,-0.07,-0.05,-0.07,-0.05,-0.08,-0.07,-0.08,-0.06,-0.07,-0.05,-0.07,-0.07,-0.08,-0.07,-0.07,-0.07,-0.05,-0.07,-0.07,-0.03,-0.05,-0.05,-0.08,-0.05,-0.07,-0.07,-0.07,-0.07,-0.07,-0.08,-0.07,-0.03,-0.07,-0.08,-0.08,-0.08,-0.05,-0.06,-0.07,-0.05,-0.07,-0.07,-0.07,-0.05,-0.08,-0.07,-0.08,-0.07,-0.08,-0.08,-0.07,-0.07,-0.03,-0.07,-0.07,-0.07,-0.07,-0.06,-0.08,-0.07,-0.07,-0.05,-0.07,-0.08,-0.07,-0.08,-0.07,-0.06,-0.07,-0.05,-0.08,-0.07,-0.06,-0.07,-0.05,-0.08,-0.05,-0.07,-0.07,-0.07,-0.05,-0.05,-0.07,-0.05,-0.08,-0.08,-0.08,-0.07,-0.07,-0.07,-0.05,-0.07,-0.06,-0.07,-0.07,-0.08,-0.08,-0.07,-0.07,-0.07,-0.07,-0.05,-0.06,-0.07,-0.1,-0.07,-0.07,-0.08,-0.07,-0.08,-0.05,-0.07,-0.07,-0.07,-0.08,-0.07,-0.05,-0.07,-0.07,-0.05,-0.07,-0.07,-0.06,-0.07,-0.07,-0.07,-0.07,-0.05,-0.05,-0.05,-0.05,-0.03,-0.02,-0.02,0.01,0.04,0.09,0.13,0.18,0.26,0.31,0.4,0.46,0.56,0.67,0.72,0.86,0.95,1.04,1.17,1.22,1.34,1.42,1.51,1.64,1.68,1.79,1.89,1.95,2.04,2.07,2.18,2.21,2.28,2.32,2.37,2.42,2.45,2.48,2.48,2.48,2.47,2.46,2.43,2.4,2.34,2.31,2.25,2.18,2.11,2.07,1.97,1.92,1.87,1.79,1.75,1.67,1.62,1.56,1.5,1.48,1.43,1.38,1.32,1.29,1.28,1.23,1.19,1.17,1.12,1.11,1.06,1.06,1.04,1,0.98,0.97,0.93,0.9,0.87,0.87,0.86,0.84,0.81,0.79,0.76,0.76,0.75,0.75,0.7,0.7,0.67,0.67,0.65,0.64,0.64,0.64,0.61,0.59,0.57,0.57,0.57,0.55,0.56,0.56,0.54,0.51,0.51,0.5,0.47,0.48,0.48,0.45,0.48,0.47,0.45,0.47,0.43,0.43,0.42,0.42,0.42,0.4,0.39,0.39,0.37,0.37,0.38,0.37,0.36,0.37,0.37,0.35,0.34,0.34,0.34,0.34,0.33,0.34,0.32,0.32,0.32,0.29,0.31,0.31,0.29,0.31,0.28,0.28,0.26,0.31,0.28,0.28,0.26,0.25,0.26,0.26,0.26,0.25,0.23,0.25,0.23,0.24,0.23,0.22,0.22,0.23,0.22,0.23,0.2,0.23,0.23,0.21,0.2,0.22,0.2,0.2,0.19,0.2,0.18,0.18,0.2,0.18,0.18,0.18,0.18,0.18,0.17,0.17,0.17,0.17,0.17,0.16,0.17,0.14,0.15,0.17,0.16,0.15,0.15,0.15,0.15,0.14,0.17,0.14,0.15,0.15,0.16,0.14,0.14,0.15,0.14,0.13,0.15,0.12,0.12,0.14,0.13,0.11,0.12,0.11,0.11,0.11,0.11,0.11,0.12,0.14,0.11,0.14,0.11,0.12,0.11,0.11,0.12,0.11,0.09,0.11,0.1,0.11,0.11,0.09,0.11,0.1,0.09,0.09,0.09,0.11,0.1,0.09,0.09,0.09,0.09,0.07,0.07,0.07,0.09,0.09,0.07,0.06,0.11,0.07,0.07,0.05,0.04,0.09,0.09,0.06,0.05,0.07,0.06,0.06,0.04,0.04,0.06,0.07;];

    resolution = 4096;
    a1 = resolution/2;
    Fs = 2.5e9;
    uf = fft(ut, resolution);
    yf = fft(yt, resolution);

    h1 = yf./uf;
    h = h1(1:a1);
    f = Fs * (1:a1)/resolution;
    gain = 20 * log10(abs(h));

    figure(1);
    semilogx(f, gain); grid
    on; hold on;
    axis([1e5 1e8 -30 0]);

    p = 1;
    % __________________________________
    n1=conv([p/5.25e7 1],[p/5.3e8 1]);
    d1=conv([p/3.35e7 1], [p/9.5e7 1]);
    %___________________________________

    sys1=tf(0.72*n1,d1);
    out1=lsim(sys1,ut,t);

    n2 = d1;
    d2 = n1;
    sys2=tf((1/0.76)*n2,d2);
    out2=lsim(sys2,yt,t);

    bodemag(sys1); grid
    on;
    bodemag(sys2); grid
    on; hold off;

    figure(2);
    plot(t,ut,t,yt,t,out1,
    'r'); grid on;

    figure(3);
    plot(t,ut,t,yt,t,out2,
    'r'); grid on;

    I use a manual method of finding poles and zeros of the response. How, i can calculate the zeros and poles from the response. Am i write to reconstruct the signal input from output and output from input. Is there any other way to reconstruct such signal. How can i get T.F. from my calculated response. If anyone understand and can solve my problem please! help. How can I do this in matlab or other method.
     
Loading...