⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makepulse.m

📁 MIMO and VBLAST( please see the documentation)
💻 M
字号:
function pulse = makepulse(shape,cutoff,time,samples,rolloff,varargin)%MAKEPULSE Modulation impulse design.%   PULSE = MAKEPULSE(SHAPE,CUTOFF,TIME,SAMPLES,ROLLOFF) returns %   samples of desired SHAPE of modulation impulse. Possible values for %   SHAPE are 'SqRRC'|'Rect' a square-root raised cosine and rectangular%   shape respectively. CUTOFF corresponds to the impulse shortening%   in sense of CUTOFF * SAMPLES where TIME denotes a symbol duration. For%   example if CUTTOFF = 8 than MAKEPULSE gives the impulse of total%   length equals to 8 * SAMPLES + 1. A one sample is added to ensure%   symbol symetry and correct sampling.AMPLES corresponds to the number%   of samples per symbol. When a 'SqRRC' option is chosen than a ROLLOFF%   factor must be specified; 0 < ROLLOFF < 1. All the impulses are%   designed to have a unit energy.%%   PULSE = MAKEPULSE(...,'EchoOn') toggles function internal echo on. %%   See also MODUL.%   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>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BODY BEGIN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%switch shapecase 'Rect'  pulse = linspace(1 / sqrt(cutoff * time),...      1 / sqrt(cutoff * time),samples * cutoff);    case 'SqRRC'	singul = time / (4 * rolloff);	tt = linspace(-cutoff * time / 2,...          cutoff * time / 2,samples * cutoff + 1);		z = find(tt == 0);	k = find(abs(tt) == singul);		% Checking for singularities...  if (isempty(z) == 0) & (isempty(k) == 0) % zero & non-zero singularity      n = [find(tt < -singul),find((tt > -singul) & (tt < 0)),...        find((tt > 0) & (tt < singul)),find(tt > singul)];      t = tt(n);                pulse(n) = (1 ./ (sqrt(time) .* (1 - (4. * rolloff ./...        time) .^ 2 .* t .^2))) .* ((sin((1 - rolloff) .* pi .* t ./...        time) ./ (pi .* t ./ time)) + (4 .* rolloff .*...        cos((1 + rolloff) .* pi .* t ./ time) ./ pi));			pulse(z) = (1 / sqrt(time)) * (1 - rolloff + 4 * rolloff / pi);							pulse(k) = rolloff * ((-2 + pi) * cos(pi / (4 * rolloff)) +...        (2 + pi) * sin(pi / (4 * rolloff))) / (pi * sqrt(2) *...        sqrt(time));    elseif (isempty(k) == 0) % non-zero singularity		n = [find(tt < -singul),find(abs(tt) < singul),find(tt > singul)];		t = tt(n);            		pulse(n) = (1 ./ (sqrt(time) .* (1 - (4 .* rolloff ./...      time) .^ 2 .* t .^ 2))) .* ((sin((1 - rolloff) .* pi .* t ./...      time) ./ (pi .* t ./ time)) + (4 .* rolloff .*...      cos((1 + rolloff) .* pi .* t ./ time) ./ pi));				pulse(k) = rolloff * ((-2 + pi) * cos(pi / (4 * rolloff)) + (2 + pi) *...      sin(pi / (4 * rolloff))) / (pi * sqrt(2) * sqrt(time));      	elseif isempty(z) == 0 % zero singularity		n = [find(tt < 0),find(tt > 0)];    t = tt(n);          		pulse(n) = (1 ./ (sqrt(time) .* (1 - (4 .* rolloff ./...      time) .^ 2 .* t .^ 2))) .* ((sin((1 - rolloff) .* pi .* t ./...      time) ./ (pi .* t ./ time)) + (4 .* rolloff .*...      cos((1 + rolloff) .* pi .* t ./ time) ./ pi));				pulse(z)=(1 / sqrt(time)) * (1 - rolloff + 4 * rolloff / pi);            else % no singularity found    t = tt;       pulse = (1 ./ (sqrt(time) .* (1 - (4 .* rolloff ./...      time) .^ 2 .* t .^ 2))) .* ((sin((1 - rolloff) .* pi .* t ./...      time) ./ (pi .* t ./ time)) + (4 .* rolloff .*...      cos((1 + rolloff) .* pi .* t ./ time) ./ pi));	end end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BODY END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%if (isempty(varargin) == 0) & (varargin{end} == 'EchoOn')	[indent,gap,name] = iprompt('MAKEPULSE:');		str1 = num2str(length(pulse));	str2 = num2str(rolloff);		disp(' ');	disp([name,gap,str1,' samples of ',shape,...		' impulse generated; roll-off -> ',str2,'.']);	disp(' ');end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -