📄 modul.m
字号:
function sig_modul = modul(data,md,pulse,samples,gain,varargin)%MODUL Multidimensional digital modulator.% SIG_MOD = MODUL(DATA,MD,PULSE,SAMPLES,GAIN) performs linear% memoryless digital modulation of input DATA. The output signal % sampled SAMPLES-times per symbol period is assumed to be % a complex envelope of real bandpass signal.MD corresponds to the% number of constellation signals. Possible values for MD are 4|8|16.% This corresponds to the 4PSK, 8PSK and 16QAM signal constellations% respectively.The order of the 16QAM constellation signals is% defined via external file qam16.txt and may be arbitrarily modified.% The samples of appropriate modulation impulse must be provided to% the modulator via PULSE variable. GAIN is the value of% constellation expansion factor which may be obtained from SCALE% function.%% SIG_MOD = MODUL(...,'EchoOn') toggles internal function echo% on.%% See also MAKEPULSE, SCALE.% Copyright 2001-2002 Kamil Anis, anisk@feld.cvut.cz% Dept. of Radioelectronics, % Faculty of Electrical Engineering% Czech Technical University in Pragu% $Revision: 2.0 $ $Date: 2002/10/23 17:33:28 $% --% <additional stuff should go here>% 16QAM definitionload qam16.txt;[frame_length,space_dim,frames]=size(data);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BODY BEGIN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%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 q(:,:,k) = (2 * k1 - md - 1) - i * (2 * k2 - md - 1); otherwise expr = 2 * pi * i / md; q(:,:,k) = exp(expr * data(:,:,k)); end sig_up(:,:,k) = upsample(q(:,:,k),samples); % to compute convolution signals must be vectors -> for loop for j = 1:space_dim sig_modul(:,j,k) = gain * conv(pulse,sig_up(:,j,k)); endend%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BODY END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%if (isempty(varargin) == 0) & (varargin{end} == 'EchoOn') [indent,gap,name] = iprompt('MODUL:'); if (md == 4) | (md == 8) str1 = 'PSK'; else str1 = 'QAM'; end [m,foo1,foo2] = size(sig_modul); str2 = num2str(frame_length); str3 = num2str(frames); str4 = num2str(m); str5 = num2str(md); disp(' '); disp([name,gap,'Modulation ',str5,str1,' performed; ',str2,' symbols,',... str3,' frame(s).']); disp([indent,'Total signal length: ',str4,' samples.']); disp(' ');end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -