% Tony Hyun Kim
% EE 278B, PS#2, Problem 3

% Threshold decoder, where we test the conditions in order
%   y < s0    --> s = -1
%   y < s1    --> s = 0
%   otherwise --> s = 1
function perr = p3(s0,s1)

% s0 = -1/2;
% s1 = 1/2;
lambda = 1;

perr = 1/3*(1-laplaciancdf(lambda,s0-(-1)))+...
       1/3*(1-laplaciancdf(lambda,s1)+laplaciancdf(lambda,s0))+...
       1/3*(laplaciancdf(lambda,s1-1));