Code covered by the BSD License  

Highlights from
MATLAB for Digital Communication

image thumbnail

MATLAB for Digital Communication

by

 

The MATLAB programs in "MATLAB/Simulink for Digital Communication" authored by Won Y. Yang et. al

[decode,dictionary]=LZW_decode(cn,dictionary,pdp,codeset)
function [decode,dictionary]=LZW_decode(cn,dictionary,pdp,codeset)
% Lempel-Ziv-Welch decoding algorithm 
% cn        = Recent LAW code in character
% dictionary= Set of phrases as a cell like {'0','1','01'}
% pdp       = Previous decoded phrase 
decode_no=findstr(codeset,cn);
if decode_no<=length(dictionary) % Already in the dictionary
  decode=dictionary{decode_no};
  candidate=[pdp decode(1)]; 
 else % Not in the existent dictionary
  candidate=[pdp pdp(1)];
  % Candidate for a new phrase to add into the dictionary
  decode=candidate;
end
if isempty(strmatch(candidate,dictionary,'exact'))
  dictionary{length(dictionary)+1}=candidate; % Add a new phrase
end

Contact us