function [tST,t,f] = S_tr_time(x, fs, f_od, f_do, step_t, step_f)

    if size(x,1) < size(x,2); x = x'; end
    
    x = x(round(1:step_t:end)); fs = fs/step_t;

    N = length(x);
    t = 0:1/fs:(N-1)/fs;
    f = f_od : step_f : f_do;
    F = length(f);
    
    % -- Pre-Calculation ------------------------------------------------------

    exp_harm = cell(1,F);
    gauss = exp_harm;
    for i = 1 : F
        exp_harm{i} = exp(-1i*2*pi*f(i)/fs*(0:N-1))';
        gauss{i} = fftshift(ifft(g_window(N,f(i)*2*(N/fs)))); % ***.^1.1*nebo* 2*
        gauss{i}(gauss{i} < max(gauss{i})/1e1) = [];
    end
        
    % -- S-transform ----------------------------------------------------------

    tST = zeros(length(f),length(t));
    if f_od == 0
        tST(1,:) = mean(x);
    else
        f_shift = x .* exp_harm{1};
        tST(1,:) = conv(f_shift,gauss{1},'same');
    end

    for i = 2 : F
        f_shift = x .* exp_harm{i};
        tST(i,:) = conv(f_shift,gauss{i},'same');
    end
% -------------------------------------------------------------------------
end

function gauss = g_window(length,freq)

% Function to compute the Gaussion window for
% function Stransform. g_window is used by function
% Stransform. Programmed by Eric Tittley
%
%-----Inputs Needed--------------------------
%
%length-the length of the Gaussian window
%
%freq-the frequency at which to evaluate
%  the window.
%factor- the window-width factor
%
%-----Outputs Returned--------------------------
%
%gauss-The Gaussian window
%
factor = 1;

vector(1,:) = 0:length-1;
vector(2,:) = -length:-1;
vector = vector.^2;   
vector = vector*(-factor*2*pi^2/freq^2);
% Compute the Gaussion window
gauss = sum(exp(vector));
end



