Specify range of analog input subsystem
Note: You cannot use the legacy interface on 64-bit MATLAB®. See About the Session-Based Interface to acquire and generate data on a 64-bit MATLAB.
InputRange is a two-element vector that specifies
the range of voltages that can be accepted by the analog input (AI)
subsystem. You should configure
InputRange so that
the maximum dynamic range of your hardware is utilized.
If an input signal exceeds the
then an overrange condition occurs. Overrange detection is enabled
only if the analog input object is running and a value is specified
InputOverRangeFcn property. For many devices,
the input range is expressed in terms of the gain and polarity.
AI subsystems have a finite number of
that you can set. If an input range is specified but does not match
a valid range, then the next highest supported range is automatically
selected by the engine. If
InputRange exceeds the
range of valid values, then an error is returned. Use the
daqhwinfo function to return the input ranges
supported by your board.
Because the engine can set the input range to a value that differs
from the value you specify, you should return the actual input range
for each channel using the
get function or the
device object display summary. Alternatively, you can use the
which sets the
InputRange value and then returns
the actual value that is set.
If your hardware supports a channel gain list, then you can
You should use
InputRange in conjunction
SensorRange property. These two properties
should be configured such that the maximum precision is obtained and
the full dynamic range of the sensor signal is covered.
AI, per channel
Two-element vector of doubles
Read-only when running
The default value is supplied by the hardware driver.
Create the analog input object
ai for a National Instruments® board,
and add two hardware channels to it.
ai = analoginput('nidaq','Dev1'); addchannel(ai,0:1);
You can return the input ranges supported by the board with
InputRanges field of the
out = daqhwinfo(ai); out.InputRanges
ans = -0.0500 0.0500 -0.5000 0.5000 -5.0000 5.0000 -10.0000 10.0000
To configure both channels contained by
accept input signals between -10 volts and 10 volts:
ai.Channel.InputRange = [-10 10];
Some devices allow you to set each channel's
ai.Channel(1).InputRange = [-0.05 0.05]; ai.Channel(2).InputRange = [-10 10];
Alternatively, you can use the
ActualRange = setverify(ai.Channel,'InputRange',[-10 10]);