When you go to convert your 1-bit digital signal to an analog signal using an ideal DAC on [-1, 1], you will get the same square wave signal out of the DAC that you put in. This is because the analog signal only changes when the digital one does, and their amplitudes and biases are the same. Any samples not corresponding to a digital value change would inherit their value from the most recent sample that did.
How Do We Make an Ideal DAC in MATLAB?
Since we can’t work with truly continuous signals, the simplest method to approximate them is to use a time step size that is small relative to your digital time step size. You can use
xq = interp1(t, x, tq, ‘previous’)
as an ideal DAC, given digital sampling points t and “analog” sampling points tq. Once in the new higher sample rate you can low-pass filter, add noise, etc. until the response sufficiently represents your device. This is, however, inefficient, due to the sample points spread all over a square wave instead of being concentrated at the transitions.
How Do We Do This More Efficiently, Sample Timing-Wise?
To get efficiently placed sample points, use Simulink®. The solver will take care of placing sample points for you; an ideal DAC therefore would be the gain and bias required to change from the digital scale to the analog scale. A ZOH (Zero-Order Hold) block will keep the sample rate on the digital side constant if placed between it and the analog side, and Gain and/or Bias blocks can handle the amplitude conversion between the digital and analog realms.
Non-ideal DAC Models with Impairments
Everything I said above assumes you, like the original asker, want an ideal DAC as fast as possible. If you want to model the effects a practical DAC would have on your system a ZOH and/or Gain block will not suffice. The Mixed-Signal Blockset™ contains a Binary Weighted DAC block, which models offset error, gain error and settling time. If you want to model stochastic noise impairments (thermal, environmental, etc.), Simulink offers a selection of configurable random sources in the standard library.