Signal translation and clean up for spidyan
x = signalprocessing(TimeAxis,RawSignal,FreqTranslation)
With signalprocessing
, it is possible to frequency translate signals generated by spidyan manually or if after a long simulation automatic signal processing failed.
Signals that are detected in the simulation or lab frame contain a high-frequency component.
By translating/shifting the frequency, it is possible to center the signal around 0, which corresponds to detection in the rotating frame.
If the digital demodulation fails, the original signal is returned and the encountered error is displayed in the console.
Some common error messages are described below.
For each signal, a demodulation frequency in GHz needs to be provided.
The output is the signal after frequency translation. If the input was a cell array, the output is a cell array and if the input is a numeric array, the output is a numeric array.
TimeAxis
RawSignal
RawSignal
is a two-dimensional numeric array, the first dimension corresponds to individual time series and the second dimension to the data points within one time series.
RawSignal
is a three-dimensional numeric array, the first dimension corresponds to the acquisition points (see multi-dimensional experiments at spidyan).
The second dimension corresponds to the individual time series and the third dimension to the data points in one time series.
spidyan
, signalprocessing
will correctly process the signal structure.
FreqTranslation
RawSignal
, e.g. the second element in FreqTranslation
is the demodulation frequency for the second signal.
Keep in mind that, if you detect a signal with Ŝ+, you will want to shift your signal down to zero frequency and hence use a negative frequency.
If you use Ŝ-, your signal will oscillate at a negative frequency and you will want to shift it up to zero frequency and use a positive frequency.
Important: If Opt.FrameShift
is being used during the spidyan simulation (see there) and demodulation is done manually, the frameshift has to be taken into account.
E.g. if you simulate at Q-band frequencies (33.5 GHz) and use Opt.FrameShift = 32
, density matrices are propagated at 1.5 GHz instead of 33.5 GHz and your signal will contain a frequency component of 1.5 GHz.
The input for FreqTranslation
hence needs to be 1.5 GHz and not 33.5 GHz.
Before calling signalprocessing
, a signal needs to be obtained.
This is done by running a simulation with spidyan
.
Here, a slightly adapted version of the example given in the documentation for adiabatic passage of an electron spin S = 1/2.
More on how to design pulse experiments with spidyan
can be found on its man page.
Sys.S = 1/2; Sys.ZeemanFreq = 33.500; Pulse.Type = 'quartersin/linear'; Pulse.trise = 0.015; Pulse.Qcrit = 10; Exp.t = 0.2; Exp.Pulses = {Pulse}; Exp.Field = 1240; Exp.TimeStep = 0.00001; Exp.Frequency = [-0.100 0.100]; Exp.mwFreq = 33.5; Exp.DetEvents = 1; Opt.DetOperator = {'z1','+1'};
In contrast to the original example, Opt.FreqTranslation
was omitted, which would demodulate the signal automatically.
Therefore, plotting the signal now reveals the high frequency oscillation of the expectation value of Ŝ+:
figure(1) clf plot(TimeAxis*1000,real(Signal)); xlabel('t [ns]') axis tight ylim([-1 1]) ylabel('S_i') legend(Opt.DetOperator)
To clean up the signal, signalprocessing
has to be called with the correct frequencies for demodulation.
Ŝz is not modulated and therefore does not need to be translated:
FreqTranslation = [0 -33.5]; ProcessedSignal = signalprocessing(TimeAxis,Signal,FreqTranslation) figure(2) clf plot(TimeAxis*1000,real(ProcessedSignal)); xlabel('t [ns]') axis tight ylim([-1 1]) ylabel('S_i') legend(Opt.DetOperator)
The same results can be obtained through demodulating the signal internally in spidyan
by adding FreqTranslation
to the Opt
structure before running the simulation:
Opt.FreqTranslation = [0 -33.5]; [TimeAxis, Signal] = spidyan(Sys,Exp,Opt); figure(3) clf plot(TimeAxis*1000,real(Signal)); xlabel('t [ns]') axis tight ylim([-1 1]) ylabel('S_i') legend(Opt.DetOperator)
A common reason for this error is that you try do demodulate a signal that does not contain a high-frequency oscillation (e. g. Ŝz was the detection operator).
If this was the case, set FreqTranslation
to 0 for the corresponding signal.