DAQ Toolbox and Calibration

1 次查看(过去 30 天)
Alan Armstrong
Alan Armstrong 2012-8-20
Hi,
I've calibrated my NI-DAQ using Measurement and Automation and now I want to use this saved task in Matlab so that I can ensure it's recording at the correct range etc. I can't figure out how to call this task from Matlab.
Any help would be greatly appreciated. I have gone through many of the DAQ toolbox guides but they don't mention calibration or how to call a task in Matlab.
I'd prefer to use the legacy interface since I have Matlab R2010a but I can upgrade and use the session interface if it's easier to work with.
kind regards,
Alan

回答(1 个)

Manisha
Manisha 2012-8-24
Hi Alan,
Currently there is no way to use a saved Measurement and Automation task in MATLAB. Measurement and Automation does not give a way to access the task outside their software.
The Data Acquisition Toolbox currently does not have any in built calibration features. However having said that, you could always use MATLAB's interpolation functions.
So for example if you wanted to perform a 5 step calibration for a channel with range -10 to 10 Volts.
1. Supply -10V,-5V,0V ,5V,10V to your channel one by one and measure the actual voltage using the Data Acquisition Toolbox functions. You can run a clocked acquisition and average the results over some number of samples using the mean function
2. Now say your measured values were [ -9.1, -5.3, 0.1, 5.4, 9.8 ]
3. Now you can write your own calibrate function
function calibrated_values = calibrate(raw_values)
measured_values = [ -9.1, -5.3, 0.1 ,5.4, 9.8 ];
reference_values = [ -10 ,-5 , 0, 5 ,10 ];
calibrated_values = ...
interp1(measured_values,reference_values,raw_values);
end
interp1 by default uses Liner interpolation. There are many different ways in which you can interpolate your data, you can look at other options provided by the interp1 function .
4. Now after acquiring data, you can use your calibrate function.
Hope this helps,
Manisha
  1 个评论
Alan Armstrong
Alan Armstrong 2012-8-27
编辑:Alan Armstrong 2012-8-27
Hi,
Thank you very much for your response it answers my burning question. I will try calibrating my DAQ using the method you suggested and let you know how I get on.
many thanks,
Alan

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by