SendCustomWaveform()
Description
Sends a sequence of voltages describing a train of continuous monophasic pulses, with periodic onset times.
- This function is equivalent to SendCustomPulseTrain, but it automatically computes the pulse time vector from the specified sampling period. 
- The Phase1Duration parameter is automatically adjusted to match the sampling period on channels currently programmed to use the specified custom waveform. 
- Since the pulse width is equivalent to pulse frequency, the voltage vector defines a continuous waveform. 
Syntax
ConfirmBit = SendCustomWaveform(TrainID, SamplingPeriod, Voltages)
Parameters
- TrainID: The custom train to program (1 or 2) 
- SamplingPeriod: The width of all pulses in the train (0.0001s-3600s). Pulses are continuous. 
- Voltages: A vector of the voltage of each pulse in the train (each must be in the range of -10 to 10V). 
Returns
ConfirmBit =
1 if custom waveform was sent successfully.
0 if an error occurred during transmission.
Examples
% 1. This code generates a 100ms duration, 100Hz sine wave on output channel 1.
% Simultaneously, a 200ms white noise waveform is played on channels 3 and 4.
% All three waves are played when trigger channel 1 receives a TTL pulse.
% Peak to peak amplitude for the sine wave is 20V, spanning Pulse Pal's entire -10V - +10V output range.
SineWaveVoltages = 10*sin((2*pi/100)*(1:1000));
NoiseWaveVoltages = randn(1,1000)*2;
% For the next six lines, note the parameter codes for ProgramPulsePalParam.
ProgramPulsePalParam(1, 14, 1); % Sets output channel 1 to use custom train 1
ProgramPulsePalParam(3, 14, 2); % Sets output channel 3 to use custom train 2
ProgramPulsePalParam(4, 14, 2); % Sets output channel 4 to use custom train 2
for i = [1 3 4]
ProgramPulsePalParam(i, 11 , 1); % Sets output channel i to respond to triggers on trigger channel 1
end
SendCustomWaveform(1, 0.0001, SineWaveVoltages); % Uploads sine waveform. Samples are played at 10khz.
SendCustomWaveform(2, 0.0002, NoiseWaveVoltages); % Uploads noise waveform. Samples are played at 5khz.
TriggerPulsePal('1101'); % Soft-triggers channels 1, 3 and 4.
% 2. (Example requiring the longer 5,000 pulse sequences on Pulse Pal 2)
% Attach a speaker to output channel 1, to hear the waveform.
Wave = load ('PulsePalWave.mat'); Wave = Wave.PulsePalWave; % Loads a complex voltage waveform
ProgramPulsePalParam(1, 'CustomTrainID', 1); % Sets output channel 1 to use custom train 1
SendCustomWaveform(1, 0.0001, Wave); % Sends the waveform to Pulse Pal, sampled at 10kHz
TriggerPulsePal(1); % Triggers channel 1. Make sure your speaker volume is audible.