matlabfrequency-analysistransfer-encoding

Convert frequency Domain data of transducer to time Domain Transfer Function


I have a few .mat files that denote the characteristics of a transducer (transmitter); I want to use the data for my Matlab code, in order to observe the response it will have on my transmit signal.

The first file contains Magnitude of the transducer as follows: Each row contains the frequency response for one angle. Each column contains the angular response at one frequency.

Similarly, I have another .mat file that contains corresponding phase (in degrees) of the transmit voltage response

The frequencies (in Hz) (corresponding to the rows) are in another matrix given by a third .mat file

and similarly, The angles (in deg) (corresponding to the columns) are in another matrix given by a 4th file.

Can someone help me translate these into a Time Domain representation for a specific angle (using the Magnitude and phase information for a specific angle) and construct a Transfer Function to be used???

Any help will be appreciated.


Solution

  • In order to convert responses from the frequency domain into the time domain, you need to perform an inverse Fourier transformation. In matlab, this is done with the function ifft.

    Lets consider that you load the data from the first file into the variable magnitude and from the second file into variable phase. You have to first merge these two variables into a single complex valued matrix

    f_response = complex(magnitude.*cosd(phase),magnitude.*sind(phase));
    

    The f_response is the actual response of your transducer, and can be supplied to ifft in order to get the time domain response. However there is a complication, the assumed frequency order implied by ifft. Although matlab does not provide much details about this, if you check out the fft docs, you will see that there are two frequency branches returned by fft. The frequency responses must be ordered in a way that corresponds to matlab's expected order. If you take, for instance, the first example in the docs

    Fs = 1000;            % Sampling frequency
    T = 1/Fs;             % Sampling period
    L = 1000;             % Length of signal
    t = (0:L-1)*T;        % Time vector
    S = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
    X = S + 2*randn(size(t));
    Y = fft(X);
    

    The frequency array that corresponds to each of the Fourier transform output Y entries is:

    f = Fs/L*[0:(L/2-1),-L/2:-1];
    

    In order to correctly apply the Fourier inverse transformation, you have to check if the order in your frequencies file (lets assume you loaded its contents to the variable frequencies) has to be ordered exactly like f. Note that f has a regular increasing first branch and then makes a discontinuous jump to negative frequencies. The sign of the frequencies is used to represent the propagation direction of travelling waves. If your data only holds positive frequencies, that would be excellent because you would be able to construct the negative frequency branch easily as:

    [frequencies,ix] = sort(frequencies);
    f_response = f_response(:,ix);
    f_response = 0.5*[f_response(:,1:end-1),f_response(:,end:-1:2)];
    

    and then invert it by doing

    t_response = ifft(f_response,[],1);
    

    Note that, as you want the response for each angle, each row must be inverse transformed. This is achieved with the third input to ifft.

    If your frequencies data file has negative frequencies, then you have to order it correctly and then re-order the f_response columns accordingly. You would need to upload some sample data for me to be able to help more with that.