I'm using fsin.mod to provide sinusoidal extracellular stimulation to an axon. I have set up my code so that I can choose what frequency I would like to stimulate the axon at within the GUI, and I would also like the duration of the stimulation to remain the same for all frequencies and therefore need the number of cycles (fsin.n) to scale with the change in frequency (i.e. fsin.n = fsin.f*duration). However when I change the frequency in the GUI the number of cycles does not change, and therefore the duration of the stimulation decreases with increasing frequency.
Here is my code for setting up fsin:
Code: Select all
dur = 30 //ms
objref fsin
fsin = new Fsin(0.5) //sine wave generator
fsin.f = 5000 //Hz
fsin.amp = 20 //mA
fsin.del = 10 //ms
fsin.n = fsin.f*dur*0.001
setpointer fsin.x, is_xtra
Code: Select all
xpanel("AC Stim Settings",0)
xlabel("AC Stim Settings")
xvalue("AC amplitude (mA)","fsin.amp",1)
xvalue("AC frequency (Hz)","fsin.f",1)
xvalue("AC delay (ms)","fsin.del",1)
xvalue("AC duration (ms)","dur",1)
xvalue("AC no. of cycles", "fsin.n", 1)
Many thanks!
Theo