With the pulseEditor it is simple to make pulses consisting of one or more steps having a specific amplitude, duration, latency, and so on. It is also easy to generate a collection of pulses varying in one or more of these parameters. Step-type pulses can also be combined to produce slightly more complex types of pulses. However, any other type of pulse involving ramps, sinusoids, etc., needs to be specified outside the pulseEditor. This is done using the signalObject class.
For command-line help, type "help signalObject". Use 'get' to see a list of the 'settable' properties of a signal object.
Here is an example of how to create a pulse consisting of a simple ramp stimulus. There are a number of ways to approach parameterizing a given type of pulse. Shown here is a somewhat elaborate example. Note, the sampleRate field is optionally specified for any analytic pulse ('equation', 'distribution', 'trigonometric', etc) the sampleRate may be safely modified later, to conform to the settings in the hardware. For literally defined pulses, the sampleRate can be changed later, but it will be up/down-sampled accordingly.
deltaFPos = signalobject('Name', 'deltaFPos', 'sampleRate', 10000); deltaFNeg = signalobject('Name', 'deltaFNeg', 'sampleRate', 10000); offset = signalobject('Name', 'offset', 'sampleRate', 10000); linSig = signalobject('Name', 'linear', 'sampleRate', 10000); product1 = signalobject('Name', 'linearSegment', 'sampleRate', 10000); product2 = signalobject('Name', 'offsetSegment', 'sampleRate', 10000); finalSignal = signalobject('Name', 'result', 'sampleRate', 10000); allPulses = [deltaFPos, deltaFNeg, offset, linSig, product1, product2, finalSignal]; squarePulseTrain(deltaFNeg, -1, 1, 0.100, 0.500, 1000, 1); squarePulseTrain(deltaFPos, 1, 0, 0.100, 0.500, 1000, 1); dc(offset, 0); equation(linSig, '3 * t - 0.3'); recursive(product1, 'multiply', [deltaFPos, linSig]); recursive(product2, 'multiply', [deltaFNeg, offset]); recursive(finalSignal, 'add', [product1, product2]);
- Alternately, one could create a similar ramp by using a literal pulse. Building on the previous example results in:
data = getdata literalPulse = signalobject('Name', 'literal', 'sampleRate', 10000); allPulses{end + 1} = literalPulse; literal(literalPulse, getdata(finalSignal, 1)); %Here, we use the already created pulse to generate the data, but any array of data will suffice.
- To save the data, for use as Ephus pulses:
destDir = getDefaultCacheDirectory(progmanager, 'myCustomPulses'); if strcmpi(destDir, pwd) destDir = getDefaultCacheDirectory(progmanager, 'pulseDir'); end destDir = uigetdir(destDir, 'Choose a pulseSet for the destination of new pulses.'); if length(destDir) == 1 if destDir == 0 return; end end if exist(destDir, 'dir') error('pulseDest must be a valid directory: ''%s'' does not exist.', destDir); end setDefaultCacheValue(progmanager, 'myCustomPulses', destDir); for signal = allPulses saveCompatible(fullfile(destDir, [get(signal, 'Name') '.signal']), 'signal', '-mat'); end
- As is customary with signalobject instances, when you are finished, you should delete them.
delete(allPulses);