How calculate a impulse response from array of measured values of frequence response

Discussion in 'MATLAB' started by Richard Vital, Sep 15, 2009.

  1. I have some array of frequence response of PLC channel and I nedd to use IFFT to obtain impulse response. Can you help me ?

    Below my acctual code:

    % Resposta do canal 12
    clear all;
    close all;

    fmin = 0.300000;
    fres = 0.300000;
    fmax = 54.000000;

    % Array of Linear magnitude
    lmagrespckt = [0.265763 0.407813 0.380090 0.344173 0.685268 0.517251 0.594103 0.303319 0.197189 0.147226 0.177744 0.109913 0.184183 0.250154 0.341347 0.406213 0.464892 0.516368 0.571211 0.610119 0.636791 0.646477 0.625740 0.589800 0.567673 0.573900 0.533424 0.497058 0.427476 0.392697 0.336650 0.257814 0.161070 0.090926 0.042019 0.023304 0.076228 0.136278 0.205911 0.257513 0.292868 0.290198 0.242273 0.176373 0.155272 0.193194 0.230308 0.258363 0.331383 0.415931 0.473042 0.502810 0.514710 0.513201 0.507393 0.510185 0.555899 0.606004 0.635809 0.637125 0.605572 0.567155 0.559607 0.551330 0.528017 0.497656 0.452815 0.413340 0.401149 0.419836 0.428344 0.414659 0.371470 0.311398 0.252204 0.230724 0.254143 0.292814 0.316653 0.302290 0.270207 0.239361 0.227456 0.226817 0.222261 0.212599 0.200709 0.187578 0.175371 0.175728 0.197927 0.248319 0.310770 0.377436 0.446857 0.502520 0.532677 0.538631
    0.525234 0.499662 0.477810 0.463988 0.449905 0.401604 0.325431 0.275530 0.267257 0.281095 0.298089 0.314233 0.335190 0.358300 0.381713 0.405327 0.422832 0.430896 0.428097 0.414636 0.394032 0.371356 0.345811 0.320447 0.300846 0.281213 0.261333 0.238387 0.217574 0.201498 0.189779 0.186103 0.185507 0.196037 0.215354 0.233566 0.258206 0.287833 0.319844 0.345495 0.372013 0.396791 0.420080 0.427718 0.434724 0.445208 0.458714 0.467193 0.471267 0.481756 0.483686 0.476520 0.474301 0.486496 0.516502 0.554608 0.570455 0.580806 0.588204 0.611217 0.648625 0.669243 0.675125 0.670280 0.654769 0.643377 0.634894 0.608835 0.585934 0.571474 0.583322 0.613312 0.654077 0.685952 0.712825 0.740067 0.769530 0.768557 0.758427 0.728552 0.694500 0.662952];

    % Array of Log magnitude
    magrespckt = [-11.254 -7.414 -7.635 -8.759 -3.392 -7.076 -4.162 -9.839 -14.177 -16.283 -15.314 -21.137 -15.314 -12.144 -9.407 -7.827 -6.657 -5.742 -4.886 -4.314 -3.935 -3.773 -4.077 -4.620 -4.863 -4.832 -5.433 -6.117 -7.446 -8.060 -9.387 -12.119 -16.139 -21.164 -28.364 -35.980 -22.499 -17.161 -13.540 -11.565 -10.748 -10.473 -12.146 -14.895 -16.233 -13.898 -12.580 -11.778 -9.827 -7.776 -6.524 -5.952 -5.777 -5.847 -5.917 -5.849 -5.097 -4.370 -3.944 -3.908 -4.395 -4.942 -5.016 -5.187 -5.540 -6.114 -6.882 -7.662 -7.934 -7.595 -7.372 -7.632 -8.553 -10.168 -12.034 -12.870 -12.036 -10.634 -9.940 -10.332 -11.535 -12.574 -12.994 -12.964 -13.071 -13.450 -13.997 -14.609 -15.073 -14.996 -14.004 -12.155 -10.203 -8.470 -6.998 -5.975 -5.470 -5.389
    -5.601 -5.998 -6.491 -6.701 -7.027 -8.076 -9.902 -11.237 -11.426 -11.010 -10.487 -10.018 -9.496 -8.898 -8.404 -7.911 -7.463 -7.259 -7.364 -7.677 -8.119 -8.633 -9.237 -9.906 -10.469 -11.029 -11.692 -12.368 -13.154 -13.866 -14.421 -14.681 -14.555 -14.129 -13.461 -12.603 -11.651 -10.800 -9.953 -9.182 -8.526 -7.985 -7.619 -7.377 -7.300 -7.055 -6.770 -6.609 -6.490 -6.498 -6.415 -6.430 -6.487 -6.286 -5.700 -5.113 -4.769 -4.668 -4.674 -4.305 -3.781 -3.435 -3.389 -3.515 -3.676 -3.742 -3.961 -4.393 -4.692 -4.842 -4.661 -4.219 -3.539 -3.298 -3.004 -2.582 -2.290 -2.231 -2.438 -2.804 -3.168 -3.627];

    % Array of fase
    faserespckt = [52.17 25.07 2.08 13.75 4.66 -4.90 -40.52 -55.68 -52.36 -36.75 -59.33 -141.26 85.18 69.62 55.16 45.42 36.78 28.65 20.16 12.30 3.32 -5.93 -16.44 -22.61 -25.54 -32.41 -44.98 -49.74 -57.68 -63.43 -76.57 -88.93 -95.30 -91.32 -68.71 19.13 59.38 54.31 44.92 32.99 21.25 6.58 -3.70 0.58 18.28 35.66 35.57 40.67 43.60 38.81 30.03 22.30 15.92 11.34 8.46 8.47 7.21 2.26 -4.94 -13.26 -20.47 -23.51 -26.38 -31.40 -35.40 -40.05 -42.19 -41.63 -38.32 -38.52 -42.71 -49.09 -55.17 -57.42 -52.30 -39.69 -29.43 -28.62 -35.08 -41.95 -45.15 -42.30 -36.63 -33.49 -33.45 -31.48 -27.95 -23.66 -16.04 -4.85 6.97 13.81 14.38 10.58 3.47 -5.75 -15.20 -23.22
    -29.34 -33.70 -36.99 -39.93 -45.15 -51.30 -51.84 -44.64 -35.90 -30.11 -27.20 -25.32 -23.74 -23.75 -24.56 -26.34 -29.71 -34.35 -39.42 -44.33 -48.35 -51.83 -54.66 -56.17 -56.61 -56.45 -56.27 -55.11 -52.17 -47.75 -41.09 -34.38 -27.02 -19.83 -13.78 -9.44 -6.88 -5.69 -5.67 -6.78 -8.80 -11.70 -14.84 -17.45 -19.24 -20.76 -23.06 -25.08 -26.76 -28.39 -30.60 -32.31 -31.48 -29.56 -29.24 -31.78 -35.55 -38.58 -39.65 -40.06 -42.08 -46.08 -49.07 -52.26 -54.43 -55.73 -58.26 -59.58 -59.77 -58.20 -56.59 -55.50 -55.72 -57.03 -57.30 -58.76 -60.37 -62.89 -66.76 -70.93 -75.28 -80.26];

    % Array of Gropu delay in ns
    delayrespckt = [96.802 73.015 43.071 34.246 30.547 28.993 28.506 26.669 25.114 25.839 558.792 1010 654.725 135.359 108.370 84.544 77.408 75.795 78.128 79.151 83.397 86.778 76.367 44.531 46.116 86.212 77.202 69.758 66.796 81.176 113.391 92.410 21.487 -127.947 -478.925 -597.613 -208.489 62.282 104.586 114.599 125.348 115.859 36.212 -99.518 -165.161 -88.827 -25.306 -29.563 15.007 53.903 78.861 66.481 51.731 35.356 13.721 4.650 28.153 57.384 71.255 70.202 48.320 26.989 36.156 42.682 41.255 30.821 5.958 -17.916 -14.209 19.557 47.474 54.368 38.432 -9.858 -80.605 -107.170 -51.761 27.521 63.454 44.586 -2.595 -44.118 -40.923 -12.150 -6.514 -19.850 -35.033 -56.022 -87.748 -109.317 -88.166 -36.348 13.639 51.270 76.989 86.731 80.545 66.060
    49.021 34.224 28.679 39.446 54.307 32.280 -32.155 -75.941 -66.132 -38.305 -23.792 -17.583 -6.253 2.934 11.428 23.425 36.354 45.746 46.412 41.537 34.714 28.153 18.287 7.955 0.352450 -2.159 -4.800 -17.277 -35.344 -51.706 -62.782 -67.099 -68.557 -59.034 -41.805 -27.267 -17.892 -8.652 1.148 14.285 19.973 24.297 23.991 20.723 15.343 17.799 21.322 19.869 18.804 17.102 16.562 -0.155174 -6.876 -6.811 10.131 28.915 29.550 19.008 7.775 10.787 24.865 32.031 30.302 22.399 17.293 16.631 16.117 8.216 -7.545 -14.804 -11.743 -4.772 4.040 9.948 13.389 10.908 19.316 29.441 35.516 41.565 41.927 41.714];

    freq=fmin:fres:fmax;
    npoints=180

    for i=0:(npoints-1)
    rtf(i)= lmagrespckt(i)*cos(faserespckt(i)*pi/180);
    itf(i)= lmagrespckt(i)*(j*sin(faserespckt(i)*pi/180)
    tf(i) = rtf(i)+ itf(i);
    end

    respimp= real(ifft(tf));

    I Would like to know if this procedure is correct.
    Thanks.

    Richard
     
    Richard Vital, Sep 15, 2009
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.