Generation of time domain multisine from complex amplitudes, and preparation for downloading into an arbitrary waveform generator.
Syntax
xtim = msinprep(freqv,cx)
[xtim,df] = msinprep(freqv,cx,N,fs,dev)
Description
msinprep generates time series from a set of complex amplitudes (multisine). The complex amplitudes are usually produced by msinclip. It is assumed that the frequencies are harmoniously related and an integer number of periods is to be generated. The algorithm can introduce a predistortion for a zero-order hold.
xtim is the generated time series, df is the calculated common divider of the given frequencies. freqv is the frequency vector, where the complex amplitudes are given, cx is the vector of complex amplitudes, and N is the length of the time series. If N is not given or is empty, it will be defined as N = fs/df, where df is the maximal common divider of the frequencies in freqv.
fs is the sampling frequency. If it is not given, it will be chosen as fs = N*df. If N is not given, either, fs will be chosen as fs = df*2*(max(freqv)/df+1).
dev defines the device for which the series is prepared. Use dev = 'screen' for plotting, etc., with no modification of the Fourier series, or use dev = 'DAC' for D/A converter. In the latter case, the amplitudes will be multiplied by the inverse transfer function of the zero-order hold.
Default Argument Values
dev = 'DAC'; fs and N as defined above.
Examples
Generate a multisine and prepare it for downloading:
[cx,crx,crxmax] = msinclip([1:15]'/256,ones(15,1));
arbitgen = msinprep([1:15]'/256,cx,512,1,'DAC');
Diagnostics
freqv must be monotonously increasing, and must not exceed the half of the given or above defined fs. N must also be large enough to have at least one period of each sine. If the length of the time series is smaller than the period length, the error message will be sent:
N (...) must be at least ... for one period
If the length of the time series is not equal to an integer multiple of the period length, a warning message will be sent:
WARNING: the N (...) samples cover ... periods, this is not an integer
Algorithm
The amplitudes are divided by the transfer function of the zero-order hold. The time function is calculated by inverse FFT.
See Also
msinclip, optexcit
[ Previous | Help Desk | Next ]