Generate and acquire signals with a DT9857E box using Matlab

조회 수: 6 (최근 30일)
Galvani
Galvani 2024년 2월 19일
댓글: Thibaut 2024년 5월 20일
Hello,
i'm trying to generate and acquire signals for a study using a DT 9857E box, so i wrote a short code to test wether the result could be satisfying or not. The code is written this way:
clear all, clc, close all
s = daq("dt");
fAbtast = 50e3;
s.Rate = fAbtast; %1000;
BoxName = 'DT9857E-16(00)';
addoutput(s,BoxName, '0', 'Voltage');
addinput(s,BoxName,'0', 'Voltage');
fIn = 1e3;
t = 0:1/fAbtast:1-1/fAbtast;
x = sin(2*pi*fIn*t);
Output_data = x'*1.2;
Input_data = readwrite(s, Output_data);
figure
time_vec = seconds(Input_data.Time);
plot(time_vec, Output_data)
hold on
plot(time_vec, Input_data.Variables)
hold off
grid on
legend(["Output Signal","Acquired Signal"])
The result looks this way:
Any Idea on why the acquired signal does look that way? Since i just connected the output channel to the input channel, the same output signal or at least likely was expected to be acquired.
I even try to reproduce the example in the following matlab documentation: Simultaneously Acquire Data and Generate Signals - MATLAB & Simulink - MathWorks Deutschland
but the result did not look great:
%% Example from Matlab's documentation
% A session has been already defined
output = cos(linspace(0,2*pi,1000)');
data1 = readwrite(s, output);
figure
plot(output);
hold on
plot(data1.Variables);
ylabel("Voltage (V)")
%title("Acquired Signal");
legend(["Output Data","Acquired Signal"])
below is an enlarged view of the acquired signal
Any suggestion to fix this will be greatly appreciated.

채택된 답변

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2024년 2월 19일
It is all about DAQ
DT9857E issue.
Once we had also the same issue - a kind of exponential decay. So far, I remember what we did was to detrend the acquired data. Also, you can try to use a different channel of DT to collect data.
All the best.
  댓글 수: 8
Galvani
Galvani 2024년 5월 19일
You will need to revert back to DT Open Layers v7.8.2.
Begin within MATLAB to uninstall the 'Data Acquisition Toolbox Support Package for Data Translation Hardware' via the Add-On Manager.
Open your Windows ->Control Panel->Programs and Features showing the Data Translation software and version column, and uninstall all DT Open Layers Software( programs with DT Open Layers as Publisher)
Reboot your system and install DT Open Layers v7.8.2. Make sure that the previous installed version are no more on your system.
Finally open MATLAB and reinstall the 'Data Acquisition Toolbox Support Package for Data Translation Hardware' via the Add-On Manager.
Everything should normaly be fine from now on!
Regards,
Galvani
Thibaut
Thibaut 2024년 5월 20일
Brilliant !
Thanks a lot mate. I've simply followed the procedure you've shared and everything works fine now :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simultaneous and Synchronized Operations에 대해 자세히 알아보기

태그

제품


릴리스

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by