Sim4Life T-Neuro provides pre-defined, parametrized monopolar, bipolar and sinusoidal pulse waveforms. However there is often the need to use complex, customized waveforms. The user can use the the 'user defined' option to import text files defining the waveform profile.
The following Matlab/Octave code illustrates how such a waveform text file can be created e.g. to define an amplitude-modulate sinusoidal signal with a 1kHz carrier frequency and a 10Hz modulation frequency.
clear all; close all; % Waveform Parameters t=linspace(0,1,60000); % Creates Time Vector f=1000; % Frequency Carrier [Hz] df=10; % Frequency Modulation [Hz] % Create the Waveform v=0.5*sin(2*pi*f*t)+0.5*sin(2*pi*(f+df)*t); % Visualize the Waveform figure; plot(t(1:8000)*1000,v(1:8000)) xlabel('Time (ms)'); ylabel('Waveform [AU]') data=[t*1000 ; v]; % Write as txt file to be imported in Sim4Life dlmwrite('waveform.txt',data,'\t')