通过模拟输出通道发送输出信号

时间:2018-06-13 01:55:39

标签: matlab signals channels

我编写了一个脚本来生成随机间隔的声音,每次声音生成时我想使用适当的模拟输出通道向DAQ设备发送输出信号。但是,当我从指定的通道录制时,我没有记录电压的任何变化,而我期望1秒的矩形脉冲(如for循环中所指定的)

%Identify the device
devices = daq.getDevices
devices(5)
s = daq.createSession('ni')
addAnalogOutputChannel(s, 'Dev1', 'ao0', 'Voltage');
outputSignal = 0;
%sound specification
values = 0:1
startle_sound = 3*sin(2*pi*16000*values)

%Generate n random number between t_max and t_min
n = 5;
t_min = 10;
t_max = 20;
times = t_min + rand(1,n)*(t_max)
for t = times
    pause(t); %// Pause for t seconds   
    sound(startle_sound)
    %send signal to MoCap system
    t_out = 0:0.1:1
    d = 0:1;
    outputSignal = pulstran(t_out, d, 'rectpuls'); %rect pulse

end 

0 个答案:

没有答案