Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

i need help ( compression ecg data with wavelet and max lloyd quantifc )

Status
Not open for further replies.

ms13

Newbie level 1
Joined
May 10, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,285
i have code matlab of this compression but i have a probleme in the party of lloyd max ? i need for ur help plz
i put only the party of max lloyd quantification
Code:
% Lloyd-max algorithm using signal values 
 
% Signal      : Signal Vector 
% tol         : Tolerance  
% Initial     : Sampling levels 
% dist        : distortion 
% quant       : Sampled values 
% breakpoints : Breakpoints 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Declarations %
t = 0:.1:2*pi; % 
Signal = sin(t); %exemple of signal 
Initial=125;
tol=1e-5;
L = length(Initial);            % Number of quantization levels 
breakpoints = zeros(L-1,1);     % Breakpoints for levels 
Old_Initial = -Initial ;        % Old Initial for iterations 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Max - Lloyd Algorithm % 
 
while (norm(Initial-Old_Initial)/norm(Initial)) > tol 
     
    % Updating breakpoints % 
    breakpoints = 0.5*(Initial(1:end-1)+Initial(2:end));  
     
    % Updating levels 
    Old_Initial = Initial;  
        
    % Avoid getting zero % 
    if sum( Signal , breakpoints(1) )>=1  
       Initial(1) = mean(Signal(Signal , breakpoints(1)));  
    end 
                                           
    for i = 2: 1 : L-1, 
        if sum(Signal > breakpoints(i-1) & Signal <breakpoints(i))>=1 
           Initial(i) = mean(Signal(Signal>breakpoints(i-1) & Signal<breakpoints(i))); 
        end 
    end 
     
    if sum(Signal>breakpoints(L-1))>=1 
       Initial(L) = mean(Signal(Signal>breakpoints(L-1))); 
    end 
      
end 
 
% Quantizing with new levels % 
[indx, quant, dist] = quantiz(Signal,breakpoints,Initial);
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top