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

📄 pn_iq4.m

📁 本文件是有关于QPSK仿真的matlab源码。
💻 M
字号:
%******************************************************
%    This function generate 4-bit NRZ random number   *
%******************************************************
%
%    Date: 1/7/97  Qin Zhang    File Name: pn_iq4.m
%

function	[i,q] = pn_iq4(n,s)

% This function will generate a stream of pn data.
% A vector of length n is generated for the i and q channel.
% n is the length of the data stream. s is the number of
% samples ber bit.
	%s=4;                % four samples per symble;
	%n=200;            % for function testing only;
%rand('uniform');     %uniform distribution from 0 to 1;
x =16* rand(2,n);    % creat random number, uniform from 0 to 16;
	%hist(x(1,:));        % plot distribution plot n=50000;
x1= floor(x);        % quantize to 0 to 15;
%indx=find(x1>7);     % find index for value of 8 to 15;
x2 = x1 - 7.5;         % level shift to -7.5 to +7.5;
%x2(indx)=x2(indx)+1; % level shift from 0 to 7 to 1 to 8;
clear x;
clear x1;
x=x2;
clear x2;
	%plot(x(1,:),'*');
	%title('  4 bits random number for I data');
	%grid;
	%pause;
	%plot(x(2,:),'*');
	%title(' 4 bits random number for Q data');
	%grid;
        %pause;

y = zeros(2,s*n);
        % Insert zeros if s > 1
if (s == 1)
	y = x;
else
	y(:,1:s:s*n-1) = x(:,1:n);
end
i = y(1,:);
q = y(2,:);

	%plot(i(1:10),'*');
	%title(' I data');
	%pause;
	%plot(i(1:10),'*');
	%title(' Q data');

% END of the function pn_iq4	

⌨️ 快捷键说明

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