📄 d.txt
字号:
用于产生WCDMA 仿真信号源
close all
clear all
% Make a pulse
BufferSize = 2048;
BW = 2E6; % bandwidth in Hz
Fs = 125E6; % sampling rate
N = 2048;
IF_freq = Fs / BufferSize * 256; % 15,625,000 Hz
w = chebwin(N,80);
h = fir1(N-1,BW/Fs,w);
%h = fir1(N,BW/Fs);
figure
plot(h)
title('sinc pulse');
figure
plot(20*log10(abs(fftshift(fft(h)))))
title('fft of sinc pulse');
h = h/max(h);
h = h;
z= zeros(1,BufferSize);
% create a tone
f1 = 31.25E6;
f1 = f1 - IF_freq; % we're going to shift up by IF_freq
tonei = cos(2*pi/Fs*f1*(1:BufferSize/2));
toneq = sin(2*pi/Fs*f1*(1:BufferSize/2));
win = hanning(BufferSize/3);
win1 = win(1:end/2);
win2 = win(end/2:end);
N = BufferSize/2 - length(win1) - length(win2);
win = [win1; ones(N,1); win2];
tonei = tonei.*win';
toneq = toneq.*win';
sig = [h -h tonei] + j * [h -h toneq];
% shift up by IF_freq
sigt = sig .* exp(j * 2 * pi * IF_freq * (1:length(sig)) / Fs);
I = round(32767/sqrt(2)*real(sigt));
Q = round(32767/sqrt(2)*imag(sigt));
x = I+j*Q;
figure
plot(linspace(-Fs/2, Fs/2, length(x)), 20*log10(abs(fftshift(fft(x)))));
title('fft of upconverted signal (sinc pulse and tone burst)');
grid;
figure
plot(real(x));
hold on
plot(imag(x),'r')
title('real and imaginary parts of upconverted signal');
fid = fopen('2MHz_pulse_at_15p625MHz_and_ballast_at_31p25MHz','w');
fprintf(fid,'DataType: 0 \n');
fprintf(fid,'DataLen: 2048 \n');
fprintf(fid,'TriggerPos: 0 \n');
for i = 1:length(x)
fprintf(fid,' %8d %8d \n',real(x(i)),imag(x(i)));
end
fclose(fid);
PK = max(abs(x))
avg = sqrt(mean((real(x).^2 + imag(x).^2)))
20*log10(PK/avg)
ConfigHW.m
% *********************
% * Configure Hardware
% *********************
function err_code = configHW
% Reset ISL5239 Evaluation Board
[gcConfigStruct,err_code] = GetGC_Config;
if err_code == -1
error('Hardware Error, please check ISL5239 Evaluation Board Connections\n');
end
gcConfigStruct.GC_Mask.eRstHard = 1;
gcConfigStruct.GC_Mask.eRstSoft = 1;
gcConfigStruct.eRstHard = 1;
gcConfigStruct.eRstSoft = 1;
SetGC_Config(gcConfigStruct);
gcConfigStruct.eRstHard = 0;
gcConfigStruct.eRstSoft = 0;
SetGC_Config(gcConfigStruct);
% Setup the PD
pdConfigStruct = GetPD_Config;
pdConfigStruct.PD_Mask.eTest = 1;
pdConfigStruct.eTest = 1;
pdConfigStruct.PD_Mask.eBypass = 1;
pdConfigStruct.eBypass = 0;
pdConfigStruct.PD_Mask.eMagFnSel = 1;
pdConfigStruct.eMagFnSel = 1; % linear voltage
pdConfigStruct.PD_Mask.sOffset = 1;
pdConfigStruct.sOffset = 0;
pdConfigStruct.PD_Mask.usScale = 1;
pdConfigStruct.usScale = 256;
pdConfigStruct.PD_Mask.eActiveLUT = 1;
pdConfigStruct.eActiveLUT = 0;
SetPD_Config(pdConfigStruct);
% Initialize PD LUT to a flat characteristic
lutStruct = GetPD_Table( 0 );
lutStruct.eLUT = 0;
headRoom_dB = 4;
lutStruct.astData.usLUT_DataRe = 10.^(-headRoom_dB/20)*(2^16-1) * ones(1,1024);
lutStruct.astData.sLUT_DataIm = zeros(1,1024);
lutStruct.astData.sLUT_DataDelRe = zeros(1,1024);
lutStruct.astData.sLUT_DataDelIm = zeros(1,1024);
SetPD_Table(lutStruct);
SetPD_Config(pdConfigStruct);
% Setup the conjugate CF
cfCoefTable = getCF_CoefTable;
cfCoefTable.astData.sCoefDataI = [32767 zeros(1,12)];
cfCoefTable.astData.sCoefDataQ = [-32767 zeros(1,12)];
setCF_CoefTable(cfCoefTable);
% Setup the ODC
odcConfigStruct = GetODC_Config;
odcConfigStruct.ODC_Mask.eBypass = 1;
odcConfigStruct.eBypass = 0;
odcConfigStruct.ODC_Mask.eOffsetBinary = 1;
odcConfigStruct.eOutputValType = 1;
SetODC_Config(odcConfigStruct);
find_LUT_power_ranges.m
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -