匹配V0.38版本

master
zcy 2024-11-10 21:40:19 +08:00
parent e1fdaaf9ac
commit 13df7ffdb8
4 changed files with 64 additions and 64 deletions

View File

@ -23,28 +23,34 @@ x = 0:T/N:T;
y= x(1:2:N); %采样x的奇数点
z=x(2:2:N);%采样x的偶数点
fi=10000*sin(2*pi*30000*y) + 10000*sin(2*pi*900000*y);
fq=10000*sin(2*pi*30000*z) + 10000*sin(2*pi*900000*z);
subplot(2,2,1)
plot(fi)
subplot(2,2,2)
plot(fq)
complexArray = fi + fq*1i;
complexArray = complexArray';
%% Tx set up
tx = adi.AD9361.Tx('uri',uri);
tx.CenterFrequency = fc;
tx.DataSource = 'DMA';
tx.EnableCyclicBuffers = true;
tx.AttenuationChannel0 = -20;
i = 0;
while 1
i = i + 1;
z = i %10
pause(0.1);
fi=10000*sin(2*pi*100000*z*y);
fq=10000*sin(2*pi*100000*z*y);
subplot(2,2,1)
plot(fi)
subplot(2,2,2)
plot(fq)
complexArray = fi + fq*1i;
complexArray = complexArray';
%% Tx set up
tx(complexArray);
if i >= 5000
break; % 当i等于5时退出循环
end
end
%% Rx set up
rx = adi.AD9361.Rx('uri',uri);
@ -59,7 +65,6 @@ for k=1:10
end
end
rx.release();
tx.release();
%% Plot
nSamp = length(out);

View File

@ -294,7 +294,17 @@ classdef iio_sys_obj < matlab.System & matlab.system.mixin.Propagates ...
obj.str_cfg_in(i,j+1) = 0;
str = char(obj.str_cfg_in(i,:));
end
d = obj.iio_dev_cfg.cfg_ch(i).ctrl_dev
j = obj.iio_dev_cfg.cfg_ch(i).port_attr
s = str
if strcmp('in_voltage1_gain_control_mode',j)
continue
end
if strcmp('out_voltage_rf_bandwidth',j)
continue
end
writeAttributeString(obj.iio_dev_cfg.cfg_ch(i).ctrl_dev, obj.iio_dev_cfg.cfg_ch(i).port_attr, str);
end
end
end
@ -343,15 +353,15 @@ classdef iio_sys_obj < matlab.System & matlab.system.mixin.Propagates ...
cfg_ch_no = 0;
config = getObjConfig(obj);
if(~isempty(config))
cfg_ch_no = length(config.cfg_ch);
cgf_ch_no = length(config.cfg_ch);
end
if(data_ch_no + cfg_ch_no ~= 0)
varargout = cell(1, data_ch_no + cfg_ch_no);
if(data_ch_no + cgf_ch_no ~= 0)
varargout = cell(1, data_ch_no + cgf_ch_no);
for i = 1 : data_ch_no
varargout{i} = sprintf('DATA_IN%d', i);
end
for i = data_ch_no + 1 : data_ch_no + cfg_ch_no
for i = data_ch_no + 1 : data_ch_no + cgf_ch_no
varargout{i} = config.cfg_ch(i - data_ch_no).port_name;
end
else

View File

@ -608,11 +608,18 @@ classdef libiio_if < handle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [ret, val] = readAttributeDouble(obj, attr_name)
% Find the attribute
try
[ret, ch, attr] = findAttribute(obj, attr_name);
if(ret < 0)
val = 0;
return;
end
catch e
warning("ddd");
ret = 1;
val = 0;
return ;
end
% Create a double pointer to be used for data read
data = zeros(1, 10);
@ -679,7 +686,6 @@ classdef libiio_if < handle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function ret = writeAttributeString(obj, attr_name, str)
% Find the attribute
try
[ret, ch, attr] = findAttribute(obj, attr_name);
if(ret < 0)
return;
@ -693,10 +699,6 @@ classdef libiio_if < handle
else
calllib(obj.libname, 'iio_device_attr_write', obj.iio_dev, attr_name, str);
end
catch e
disp("error ",e)
end
end
end
end

View File

@ -1,17 +0,0 @@
T=10e-3; %信号时宽
B=3e6; %信号带宽
fs=4*B; %采样频率
N=fix(T*fs); %采样点数
x = 0:T/N:T;
f=sin(2*pi*300*x) + sin(2*pi*200*x);
plot(f)
y= x(1:2:N); %采样x的奇数点
z=x(2:2:N);%采样x的偶数点
I =