Skip to content
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

ZMT zurich med tech

  1. Home
  2. Sim4Life
  3. Simulations & Solvers
  4. T-Neuro
  5. User-Defined Waveforms

User-Defined Waveforms

Scheduled Pinned Locked Moved T-Neuro
3 Posts 2 Posters 721 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • AntoninoMCA Offline
    AntoninoMCA Offline
    AntoninoMC
    wrote on last edited by AntoninoMC
    #1

    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')
    
    1 Reply Last reply
    1
    • K Offline
      K Offline
      KJ
      wrote on last edited by
      #2

      Thanks! This is really what I want to know. This should be included in HTML manual.

      AntoninoMCA 1 Reply Last reply
      0
      • K KJ

        Thanks! This is really what I want to know. This should be included in HTML manual.

        AntoninoMCA Offline
        AntoninoMCA Offline
        AntoninoMC
        wrote on last edited by AntoninoMC
        #3

        @kj Here there is the equivalent Python code. Sometimes it is easier to have all code produced within Sim4Life.

        import numpy as np
        
        ## Waveform Parameters
        t=np.linspace(0,1,60000);  # Creates Time Vector
        f=1000                    # Frequency Carrier [Hz]
        df=10;                     # Frequency Modulation [Hz]
        
        ## Create the Waveform
        v=0.5*np.sin(2*np.pi*f*t)+0.5*np.sin(2*np.pi*(f+df)*t);
        
        # Creates The Data Structure
        data=np.array([t*1000,  v])
        
        ## Write as txt file to be imported in Sim4Life
        np.savetxt(filename, data, delimiter=' ',fmt='%1.4f')
        
        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Search