| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Data Acquisition Toolbox |
| Contents | Index |
| Learn more about Data Acquisition Toolbox |
| On this page… |
|---|
Analog Input Engineering Units Properties |
The Data Acquisition Toolbox software provides you with a way to linearly scale analog input signals from your sensor. You can associate this scaling with specific engineering units, such as volts or Newtons, that you might want to apply to your data. When specifying engineering units, there are three important considerations:
The expected data range produced by your sensor. This range depends on the physical phenomena you are measuring and the maximum output range of the sensor.
The range of your analog input hardware. For many devices, this range is specified by the gain and polarity. You can return valid input ranges with the daqhwinfo function.
The engineering units associated with your acquisition. By default, most analog input hardware converts data to voltage values. However, after the data is digitized, you might want to define a linear scaling that represents specific engineering units when data is returned to the MATLAB workspace.
The properties associated with engineering units and linearly scaling acquired data are as follows:
Property Name | Description |
|---|---|
Specify the range of data you expect from your sensor. | |
Specify the range of the analog input subsystem. | |
Specify the engineering units label. | |
Specify the range of data as engineering units. |
Note If supported by the hardware, you can set the engineering units properties on a per-channel basis. Therefore, you can configure different engineering unit conversions for each hardware channel. |
Linearly scaled acquired data is given by the formula
scaled value = (A/D value)(units range)/(sensor range)
Note The above formula assumes you are using symmetric units range and sensor range values, and represents the simplest scenario. If your units range or sensor range values are asymmetric, the formula includes the appropriate offset. |
The A/D value is constrained by the InputRange property, which reflects the gain and polarity of your hardware channels, and is usually returned as a voltage value. You should choose an input range that utilizes the maximum dynamic range of your A/D subsystem. The best input range is the one that most closely encompasses the expected sensor range. If the sensor signal is larger than the input range, then the hardware will usually clip (saturate) the signal.
The units range is given by the UnitsRange property, while the sensor range is given by the SensorRange property. SensorRange is specified as a voltage value, while UnitsRange is specified as an engineering unit such as Newtons or g's (1 g = 9.80 m/s2). These property values control the scaling of data when it is extracted from the engine with the getdata function. You can find the appropriate units range and sensor range from your sensor's specification sheet.
For example, suppose SensorRange is [-1 1] and UnitsRange is [-10 10]. If an A/D value is 2.5, then the scaled value is (2.5)(20/2) or 25, in the appropriate units.
This example illustrates how to configure the engineering units properties for an analog input object connected to a National Instruments PCI-6024E board.
An accelerometer is connected to a device which is undergoing a vibration test. Your job is to measure the acceleration and the frequency components of the device while it is vibrating. The accelerometer has a range of ±50 g, a voltage sensitivity of 99.7 mV/g, and a resolution of 0.00016 g.
The accelerometer signal is input to a Tektronix TDS 210 digital oscilloscope and to channel 0 of the data acquisition board. By observing the signal on the scope, the maximum expected range of data from the sensor is ±200 mV, which corresponds to approximately ±2 g. Given this constraint, you should configure the board's input range to ±500 mV, which is the closest input range that encompasses the expected data range.
You can run this example by typing daqdoc5_8 at the MATLAB Command Window.
Create a device object — Create the analog input object AI for a National Instruments board. The installed adaptors and hardware IDs are found with daqhwinfo.
AI = analoginput('nidaq','Dev1');Add channels — Add one hardware channel to AI.
chan = addchannel(AI,0);
Configure property values —- Configure the sampling rate to 200 kHz and define a two-second acquisition.
duration = 2; ActualRate = setverify(AI,'SampleRate',200000); set(AI,'SamplesPerTrigger',duration*ActualRate)
Configure the engineering units properties. This example assumes you are using a National Instruments PCI-6024E board or an equivalent hardware device. SensorRange is set to the maximum accelerometer range in volts, and UnitsRange is set to the corresponding range in g's. InputRange is set to the value that most closely encompasses the expected data range of ±200 mV.
set(chan,'SensorRange',[-5 5]) set(chan,'InputRange',[-0.5 0.5]) set(chan,'UnitsRange',[-50 50]) set(chan,'Units','g (1 g = 9.80 m/s/s)')
Acquire data — Start the acquisition and wait before acquiring data.
start(AI) wait(AI,duration+1)
Extract and plot all the acquired data.
data = getdata(AI); subplot(2,1,1),plot(data)
Calculate and display the frequency information.
Fs = ActualRate; blocksize = duration*ActualRate; [f,mag]= daqdocfft(data,Fs,blocksize); subplot(2,1,2),plot(f,mag)
Clean up — When you no longer need AI, you should remove it from memory and from the MATLAB workspace.
delete(AI) clear AI
The properties related to engineering units provide a way for The Data Acquisition Toolbox software to convert raw measurement data into its original values and units.
SensorRange is the output voltage range that your sensor is capable of producing.
UnitsRange is the range of real-world values (physical phenomena) that your sensor is measuring.
In many cases, it is appropriate to set InputRange, SensorRange, and UnitsRange to the same values. However, if there are significant differences in these ranges or the data is not symmetric, then using different values for these properties might be appropriate, as illustrated in the following scenario.
Suppose you have a speed sensor that generates 5 volts to 7 volts according to the detected speed, so you set SensorRange to [5 7]. When the sensor detects a speed of 0 m/s it generates a 5-volt signal; when it senses 20 m/s, it generates a 7-volt signal; so you set UnitsRange to [0 20].

For example, when the sensor transmits 6 volts, the Data Acquisition Toolbox software converts this value according to the formula
scaled value = (Sensor output - Offset) x (UnitsRange)/(SensorRange)
scaled value = (6 V - 5 V) x (20 - 0)/(7 - 5)
scaled value = (1) x (20)/(2)
scaled value = 10 m/s
For a sensor output value of 6.5 V, scaled value = (6.5 - 5) x (20)/(2) = 15 m/s; and so on, as shown in the following graph.

![]() | Events and Callbacks | Analog Output | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |