The sine waves look fine if I check with 'plot(time, outputdata)'. However, the signal coming out of the DT9837A does not sound like a sine wave. If I feed the output channel signal back into input channel 2 and plot it using 'plot(time, data)' it gives a diagram which looks like the pictures attached to this post. The frequency is correct, but the shape of the signal does not represent a sine wave at all. Instead, it is composed of asymmetrical small bursts of 48kHz (which is half of my sampling rate).

Zoomed in below

If I use QuickDAQ with otherwise same setup, it generates a clean sine wave. But not in MATLAB. What am I doing wrong here?

## Question

## Domme

Hello,

I would like to generate sine waves in MATLAB and send them to an external amplifier via DT9837C. This is the code I am using:

`d = daq('dt'); % Define Channels % Microphone in0 = addinput(d, "DT9837-C(00)", "0", "IEPE"); in0.Range = [-1 1]; in0.TerminalConfig='SingleEnded'; in0.Coupling='AC'; in0.ExcitationCurrentSource='Internal'; in0.ExcitationCurrent = .002; % Distance sensor in1 = addinput(d, "DT9837-C(00)", "1", "Voltage"); in1.Range = [-10 10]; in1.TerminalConfig='SingleEnded'; in1.Coupling='DC'; % Output Feedback in2 = addinput(d, "DT9837-C(00)", "2", "Voltage"); in2.Range = [-10 10]; in2.TerminalConfig='SingleEnded'; in2.Coupling='DC'; % Output out = addoutput(d, "DT9837-C(00)", "0", "Voltage"); % Measurement parameters duration = 2; samplerate = 96000; freq = 200; d.Rate = samplerate; % Generate output signal dt = 1/samplerate; % s / Sample t = (0:dt:duration)'; % s outputdata = 1*sin(2*pi*freq*t); [data,time] = readwrite(d,outputdata,"OutputFormat","Matrix");`

The sine waves look fine if I check with '

plot(time, outputdata)'.However, the signal coming out of the DT9837A does not sound like a sine wave. If I feed the output channel signal back into input channel 2 and plot it using'plot(time, data)'it gives a diagram which looks like the pictures attached to this post. The frequency is correct, but the shape of the signal does not represent a sine wave at all. Instead, it is composed of asymmetrical small bursts of 48kHz (which is half of my sampling rate).Zoomed in below

If I use QuickDAQ with otherwise same setup, it generates a clean sine wave. But not in MATLAB. What am I doing wrong here?

Kind regards,

Domme

Edited by Domme## Link to comment

## Share on other sites

## 2 answers to this question

## Recommended Posts

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account## Sign in

Already have an account? Sign in here.

Sign In Now