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

📄 barker.m

📁 barker码产生的源程序
💻 M
字号:
%Script file:  Barker.m
%
% Purpose:
%   To calculate and download an arbitrary waveform file that simulates a
%   simple 7 bit barker RADAR signal to the PSG vector signal generator. 
%
%   Record of revisions:
%
%   Date        Programmer      Description of change
%   ====        ==========      =====================
%   4/15/2002   Randal Burnette Initial version for 2002 AD Symposium 
%   8/14/2002   John Hutmacher  First draft  
%   9/4/2002    Randal Burnette Added Preset, turned ALC off, and IQ Scaling 
%   6/26/2003   Randal Burnette Added Modulation ON
%   
%
%   Define pulse variables:
%
%   n       -- counting variable (no units)
%   ramp    -- ramp from -1 to almost +1; used to build sine waves
%   rise    -- raised cosine pulse rise-time definition (samples)
%   on      -- pulse on-time definition (samples)
%   fall    -- raised cosine pulse fall-time definition (samples)
%   off     -- pulse off-time definition (samples)
%   i       -- in-phase modulation signal (samples)
%   q       -- quadrature modulation signal (samples)
%   pm      -- phase modulation
%   sampclk -- clock freq for the D/A converters in the IQ modulator
%   neg_pos -- transition from low bit to high bit      
%   pos_neg -- transition form high bit to low bit 
%   pos_pos -- defines high bit 
%   neg_neg -- defines low bit 
%   pos     -- defines high bit 
%   neg     -- defines low bit

sampclk = 100e6;                % defines the ARB Sample Clock for playback

n=4;                            % defines the number of points in the rise-time & fall-time
ramp=-1:2/n:1-2/n;                 % number of points translated to time
rise=(1+sin(ramp*pi/2))/2;      % defines the pulse rise-time shape
on=ones(1,120);                 % defines the pulse on-time characteristics
fall=(1+sin(-ramp*pi/2))/2;     % defines the pulse fall-time shape
off=zeros(1,896);               % defines the pulse off-time characteristics
am=[rise on fall off];          % defines the pulse envelope

neg_pos=(1+sin(ramp*pi/2))-1;      % 
pos_neg=(1+sin(-ramp*pi/2))-1;
pos_pos=ones(1,4);
neg_neg=-ones(1,4);
pos=ones(1,13);
neg=-ones(1,13);

pm=(pi/2)*[0 0 0 ...
        [rise pos]...           %Bit 1  high
        [pos_pos pos]...        %Bit 2  high
        [pos_pos pos]...        %Bit 3  high
        [pos_neg neg]...        %Bit 4  low
        [neg_neg neg]...        %Bit 5  low
        [neg_pos pos]...        %Bit 6  high
        [pos_neg neg]...        %Bit 7  low
        rise-1 0 0 off];

% plot the pm-samples and scale the plot 
plot(pm)
axis ([0 length(pm) -2 2])

% convert am and pm to i and q
i= am.* cos(pm);
q= am.* sin(pm);

% define a composite iq matrix for download to the PSG using the 
% PSG/ESG Download Assistant
IQData = [i + (j * q)];

% define a marker matrix and activate a marker to indicate the beginning of the waveform
Markers = zeros(2,length(IQData));  %fill Marker array with zero ie. no markers set
Markers(1,1:10) = 1;                %set Marker to first ten points of playback

% make a new connection to the PSG over the GPIB interface
io = agt_newconnection('gpib',0,19);

% verify that communication with the PSG has been established
[status, status_description,query_result] = agt_query(io,'*idn?');
if (status < 0) return; end

% preset the instrument
[status, status_description] = agt_sendcommand(io,':STATus:PRESet');

% set carrier frequency and power on the PSG using the PSG Download Assistant
[status, status_description] = agt_sendcommand(io, 'SOURce:FREQuency 1e9');
[status, status_description] = agt_sendcommand(io, 'POWer 0');

% put the ALC into manual control and set the IQ real time scaling 
[status, status_description] = agt_sendcommand(io, 'POWer:ALC:STATe OFF');
[status, status_description] = agt_sendcommand(io, 'RADio:ARB:RSCaling 70.7');

% download the iq waveform the PSG baseband generator for playback
[status, status_description] = agt_waveformload(io, IQData, 'barker', sampclk, 'play', 'no_normscale', Markers);

% Turn on modulation
[status, status_description ] = agt_sendcommand( io, 'OUTPut:MODulation:STATe ON');

% Turn on RF output power
[status, status_description ] = agt_sendcommand( io, 'OUTPut:STATe ON' );

⌨️ 快捷键说明

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