Obtain frequency response from impulse response

Discussion in 'MATLAB' started by Alexander Petrov, May 18, 2008.

  1. Hello,

    My task: Compute frequency response (bode plot) from
    impulse response data.

    I've read this article
    (http://model.exponenta.ru/achx02.html) and write the
    Matlab code to realize the article's algorithm. Underscore:
    I have just experemental data not the transfer function in
    analytical form.

    Matlab code:
    %%%%%%%%%%%%%%%%%%%%%%%%CODE BEGIN%%%%%%%%%%%%%%%%%%%%%%%%%
    Tend=1000;

    fs=2100; % sampling rate
    t = 0:1/fs:Tend; % sampling
    instants
    N=length(t);

    input=[1;zeros(N-1,1)]; % modelling the
    obtaning impulse reponse data
    ws=tf([10],[1 1 1 1 1]);
    data=lsim(ws,input,t);

    temp = fft(data,N); % perform N-
    point transform
    fftdata = temp(1:N/2); % just look at
    first half


    m = 20*log10(abs(fftdata)); % m = magnitude
    of sinusoids
    p = unwrap(angle(fftdata)); % p = phase of
    sinusoids, unwrap()
    % copes with 360
    degree jumps

    f = (0:N/2-1)*fs/(N); % calculate
    Hertz values

    % plot spectrum 0..fs/2 :
    figure('Name','MyBode')
    subplot(2,1,1), semilogx(f,m); % plot magnitudes
    ylabel('Abs. Magnitude'), grid on;
    subplot(2,1,2), semilogx(f,p*180/pi); % plot phase in
    degrees
    ylabel('Phase [Degrees]'), grid on;
    xlabel('Frequency [Hertz]');


    figure('Name','Bode'),bode(ws);

    %%%%%%%%%%%%%%%%%%%%%%%%CODE END%%%%%%%%%%%%%%%%%%%%%%%%%

    Assume ws=tf([10],[1 1]);
    Compare with bode(ws) and get:
    http://files.rsdn.ru/39468/2.GIF (40Кб)

    Assume ws=tf([10],[1 1 1 1 1]);
    Compare with bode(ws) and get:
    http://files.rsdn.ru/39468/5.GIF (35Кб)

    Why there is such differences between Matlab bode
    function's results and results of my algorithm ? How to
    compute frequency response from impulse response data in
    Matlab.

    Thank you
     
    Alexander Petrov, May 18, 2008
    #1
    1. Advertisements

  2. <g0onap$jo7$>...
    :
    SNIP
    :

    Hi
    Maybe that the text to the time series library tslib,
    FEX Id 14527 could help you.
    Mira
     
    Miroslav Balda, May 18, 2008
    #2
    1. Advertisements

  3. Alexander Petrov

    Chintan Guest

    Hello Mira

    I just confused about your reply, what does this mean "
    text to the time series library tslib, FEX ID 14527 could
    help` please give me idea because i am facing same problem
    with fft
    thnakign you
    cheers
     
    Chintan, Aug 13, 2008
    #3
  4. Alexander Petrov

    David Guest

    David, Aug 13, 2008
    #4
  5. Hello

    This message has not been written by me. It is the result of
    som hacker attack. He used my name and address and send my
    old message dated in may. I do not see any reason for it. He
    only brought somebody to mistakes. Of course, that Time
    series library can't help you for solving the problem of
    transforming inpulse response to frequency response. That
    should be done by properly scaled Fourier transform.

    Sorry, but I am not guilty for it.

    Mira
     
    Miroslav Balda, Aug 13, 2008
    #5
    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.