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

📄 apkconst.m

📁 数字通信第四版原书的例程
💻 M
字号:
function yy=apkconst(nir, air, pir)
%APKCONST Plots ASK/PSK constellation.
%       APKCONST(NIC, AIC, PIC) plots the constellation with the number in
%       each circle specified in NIC (Number_In_Circle); amplitude in each
%       circle specified AIC (Amplitude_In_Circle); and phase in each circle
%       specified in PIC (Phase_In_Circle, in rad). The number of points is
%       evenly distributed on each circle with one of the points having its
%       phase been specified.
%
%       APKCONST(NIC, AIC) plots the constellation with default PIC as all
%       zeros.
%
%       APKCONST(NIC) plots the constellation with default AIC as unit
%       increment for each circle.
% 
%       Y = APKCONST(...) outputs a complex vector with its real part as the 
%       in-phase component and the imaginary part as the quadrature component.
%

%       Wes Wang 5/3/94, 9/30/95
%       Copyright (c) 1995-96 by The MathWorks, Inc.
%       $Revision: 1.1 $  $Date: 1996/04/01 17:51:52 $
%       

if nargin <= 0
    disp('usage: APKCONST(NIC, AIC, PIC)');
    return
end;

m = length(nir);
if nargin <= 1
    air = [1:m];
end;

if nargin <= 2
    pir = zeros(1,m);
end;

if nargout < 1
    plot_flag = 1;
else
    plot_flag = 0;
end;

j=sqrt(-1);
z = exp(j*[0:100]*pi/50);
x=real(z); y=imag(z);
if plot_flag
    cax = newplot;
    hold_state = ishold;
    plot(x*max(air), y*max(air));
    if ~hold_state
        hold on
    end;
    zz=axis*1.05;
    plot(zz(1:2),[0,0],'w');
    plot([0,0],zz(3:4),'w');
end;
z=[];
for i = 1:m
    for k = 1:nir(i)
        z = [z air(i)*exp(j*((k-1)*2*pi/nir(i)+pir(i)))];
    end;
    if plot_flag
        if (i ~= m)
            plot(x*air(i), y*air(i));
        end;
    end;
end;
% plot the ASK/PSK signal.
if plot_flag
    plot(z,'*r');

    if ~hold_state
        axis('equal');
        axis('off');   
        text(zz(1)+(zz(2)-zz(1))/4, zz(3)-(zz(4)-zz(3))/30, 'ASK/PSK Constellation');
        hold off;
    end;
else
    yy = z;
end;

⌨️ 快捷键说明

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