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

📄 agt_qpsk.m

📁 agt_QPSK 产生QPSK 信号
💻 M
字号:
% PSG/ESG Download Assistant, Version 1.6
% Copyright (C) 2003,2005 Agilent Technologies, Inc.
%
% function [status, description] = agt_sample
% This is an example of how to use the PSG/ESG Download Assistant
% to download a simple waveform to the instrument.

%io = agt_newconnection('gpib',0,19);
% Use the next line if connection via TCPIP and comment out previous line
% For further information on agt_newconnection, type in
% help agt_newconnection at the MATLAB command prompt
 
% Constructing waveform data.  IQ data is in the form of a vector
% that contains a series of complex numbers (the form is i + jq).
% clear all
% delete all

Symbol_rate = 6.952e6;                                                                      %符号率,对于QPSK信号,一个符号对应两个码,所以此时的
                                                                                            % 码率=2* 符号率


Data = randsrc(1,1000,[1 -1]);                                                              %QPSK
%Data = randsrc(1,50000,[3.5 2.5 1.5 0.5 -0.5 -1.5 -2.5 -3.5]/3.5);                                 %64QAM
%Data = randsrc(1,50000,[7.5 6.5 5.5 4.5 3.5 2.5 1.5 0.5 -0.5 -1.5 -2.5 -3.5 -4.5 -5.5 -6.5 -7.5]/7.5);               %256QAM


Raw_I = Data(1:2:end);
Raw_Q = Data(2:2:end);
% figure(1)
%stem(Raw_I,Raw_Q);
Sample_N = 6;                                                                  %采样点
I_upsample = upsample(Raw_I,Sample_N);                                         %增加输入信号的采样率,并不改变原来的数据 
Q_upsample = upsample(Raw_Q,Sample_N);
F = rcosfir(0.15,[-8 8],Sample_N,5,'sqrt');                                        %根升余弦滤波器


% [h,w] = freqz(F);
% plot(w,20 * log10(abs(h)),'-');
% 
% Hq = qfilt('fir',{F});
% [h,w,units,href] = freqz(Hq);
% plot(w,20 * log10(abs(h)),'-',w,20 * log10(abs(href)),'--')
% legend('Quantized filter','Reference filter',3)
% xlabel('Frequency in rad/sample')
% ylabel('Magnitude in dB')
% title('Magnitude of the Frequency Response Compared')


% function[C] = circonvolution(F,A)
% End = I_upsample(1:length(F));
% Head = I_upsample(end-length(F)+1:end);
% K = [Head I_upsample End];
% G = conv(K,F);
% C = G(1+length(F):end-2*length(F)+1);


I = circonvolution(F,I_upsample);                                          %I路成形滤波 
Q = circonvolution(F,Q_upsample);

IQData = [I + (j * Q)]*0.7;
% figure(1)
plot(I,Q)
% scatter(I,Q);
Y=fftshift(IQData,512);
Pyy = Y.* conj(Y) / 512;

f = 0:3000-1;
% plot(f,Pyy(1:512))
plot(f,abs(Y))
title('Frequency content of y')
xlabel('frequency (Hz)')




plot(I,Q)
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

% io = agt_newconnection('tcpip','0.0.0.0');
io = agt_newconnection('TCPIP','192.168.1.2');
%io = agt_newconnection('gpib',0,19);
% agt_query can send a query to the instrument.
% For further information about the input and output parameters, type in
% help agt_query at the MATLAB command prompt
[status, status_description ,query_result] = agt_query(io,'*idn?');
if (status < 0) return; end

% agt_sendcommand sends SCPI strings to the instrument
% For further information about the input and output parameters, type in
% help agt_sendcommand at the MATLAB command prompt
[status, status_description] = agt_sendcommand(io, 'SOURce:FREQuency 220000000');
[status, status_description] = agt_sendcommand(io, 'POWer -10');

% agt_waveformload downloads (and optionally plays) data on the signal generator.
% For further information about the input and output parameters, type in
% help agt_waveformload at the MATLAB command prompt
[status, status_description] = agt_waveformload(io, IQData, 'Btype', Symbol_rate*Sample_N, 'play', 'no_normscale', Markers);

% The following call to agt_waveformload demonstrates the minimum set of parameters
% required to download IQ data to the instrument.
% If no ArbFileName is provided, default will be 'Untitled'.
% If no sample frequency is provided, default will be what the signal generator
% has been set to.
% If no play flag has been provided, default will be 'play' so that the waveform will
% be played on the instrument
% If no normscale flag has been provided, default will be to normalize and scale
% the data at 70%
% If no Markers structure has been generated, default will be no markers set.
% [status, status_description] = agt_waveformload(io, IQData);

% Turn RF output on
% Uncomment the agt_sendcommand if RF output should be turned on.
[ status, status_description ] = agt_sendcommand( io, 'OUTPut:MODulation:STATe ON'); 
[ status, status_description ] = agt_sendcommand( io, 'OUTPut:STATe ON' );
 

⌨️ 快捷键说明

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