Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The basic idea is to use two separate loops. The outer loop is over the <code>chi</code> variable values, whereas the inner loop is over the <code>i</code> variable values. Referring to the above diagram in the original question, the <code>i</code> variable corresponds to the x-axis (time), and the <code>j</code> variable corresponds to the y-axis (frequency). Assuming that the <code>chi</code>, <code>i</code>, and <code>j</code> variables can take on any real number, <a href="http://en.wikipedia.org/wiki/Bilinear_interpolation" rel="nofollow">bilinear interpolation</a> is then used to find an amplitude corresponding to an element in matrix <code>M</code>. The integration is just an averaging over elements of <code>M</code>.</p> <p>The following code snippet provides an overview of the basic algorithm to express elements of a matrix as a vector using the spectral collapsing from 2D to 1D. I can't find any reference for this, but it is a solution that works for me.</p> <pre><code>% Amp = amplitude vector corresponding to Figure 11.5(b) in book reference % M = matrix corresponding to the absolute value of the complex Gabor transform % matrix in Figure 11.5(a) in book reference % Nchi = number of chi in chi vector % prod = product of timestep and frequency step % dt = time step % domega = frequency step % omega_max = maximum angular frequency % i = time array element along x-axis % j = frequency array element along y-axis % current_i = current time array element in loop % current_j = current frequency array element in loop % Nchi = number of chi % Nivar = number of i variables % ivar = i variable vector % calculate for chi = 0, which only occurs when % t = 0 and omega = 0, at i = 1 av0 = mean( M(1,:) ); av1 = mean( M(2:end,1) ); av2 = mean( [av0 av1] ); Amp(1) = av2; % av_val holds the sum of all values that have been averaged av_val_sum = 0; % loop for rest of chi for ccnt = 2:Nchi % 2:Nchi av_val_sum = 0; % reset av_val_sum current_chi = chi( ccnt ); % current value of chi % loop over i vector for icnt = 1:Nivar % 1:Nivar current_i = ivar( icnt ); current_j = (current_chi / (prod * (current_i - 1))) + 1; current_t = dt * (current_i - 1); current_omega = domega * (current_j - 1); % values out of range if(current_omega &gt; omega_max) continue; end % use bilinear interpolation to find an amplitude % at current_t and current_omega from matrix M % f_x_y is the bilinear interpolated amplitude % Insert bilinear interpolation code here % add to running sum av_val_sum = av_val_sum + f_x_y; end % icnt loop % compute the average over all i av = av_val_sum / Nivar; % assign the average to Amp Amp(ccnt) = av; end % ccnt loop </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload