www.pudn.com > SpacetimeMatlabCode.rar > modul.m, change:2004-03-25,size:1122b


function sig_modul = modul(data,md,sim_options) 
 
%************************************************************************** 
%MODUL Multidimensional digital modulator 
%   S = MODUL(Q,MD,'PropertyName',PropertyValue,...) performs linear 
%   memoryless digital modulation of channel symbols.MD corresponds to the 
%   number of constellation signals. Possible values for MD are 4|8|16  
%   which corresponds to 4PSK, 8PASK and 16QAM constellations 
%   respectively. 
%************************************************************************** 
 
 
% 16QAM definition 
load qam16.txt; 
[frame_length,space_dim,frames]=size(data); 
 
for k = 1:frames 
	switch md 
	case 16         % 16QAM 
		for l = 1:space_dim 
		k1(:,l) = qam16(data(:,l,k) + 1,1); 
		k2(:,l) = qam16(data(:,l,k) + 1,2); 
		end 
		if sim_options.Channel_Est==1 
		    q(:,:,k) =( (2 * k1 - md - 1) - i * (2 * k2 - md - 1)); 
        else 
  		    q(:,:,k) = ((2 * k1 - md - 1) - i * (2 * k2 - md - 1)); 
        end       
		 
	otherwise 
		    expr = 2 * pi * i / md; 
		    q(:,:,k) = exp(expr * data(:,:,k)); 
	end 
	 
    sig_modul=q; 
	 
end