  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SAMPLE CODE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Reading the speech signal
[s, fs] = wavread('H.22.16k.wav');

% Remove mean value (DC component)
s = s - mean(s);

% Signal length
D = length(s);

% Frame length (30 ms, how many samples? )
L = INSERT CODE HERE

% Frame shift (10 ms, how many samples? )
U = INSERT CODE HERE

% Window type (Hamming)
win = hamming(L);

% Number of frames
Nfr = INSERT CODE HERE

% Memory allocation (for speed)
energy = zeros(1, Nfr+1);
ZCr = zeros(1, Nfr+1);

% Loop which calculates the speech features
for i = 1:1:Nfr
    frame = INSERT CODE HERE % a frame of speech windowed by the Hamming window
    energy(i) = INSERT CODE HERE % calculate energy
    ZCr(i) = INSERT CODE HERE % calculate zero crossings
    T(i) = L/2 + (i-1)*U; % Next analysis time instant
end

% THRESHOLDS (you can play with it!)
Ethres = mean(energy)/2;
ZCRthres = (3/2)*mean(ZCr) - 0.3*std(ZCr);

% Classification for each frame
for i = 1:1:Nfr
    if INSERT CONDITION HERE
        % VOICED
        VUS(i) = 1.0;
    elseif INSERT CONDITION HERE
        % SILENCE
        VUS(i) = 0.0;
    elseif INSERT CONDITION HERE
        % UNVOICED
        VUS(i) = 0.5;
    end
end

% Interpolation with interp1
VUSi = INSERT CODE HERE

% Visualize
figure;
t = 0:1/fs:length(s)/fs-1/fs;
plot(t, VUSi);
hold on; plot(t, s/max(s), 'r'); hold off;
xlabel('Time (s)');
title('Energy & Zero-Crossings Rate-based VUS discrimination');
grid;