Hi,
I would like to modify the IClampnoise (viewtopic.php?f=16&t=2055&p=17467#
) in order to tune the frequency of the input signal.
I would like to have something similar to the current generated by a sinusoidal function as
i= constantAmp*cos(2*pi*(t-del)*freq*(0.001))
where I can tune freq.
How can I change the amp=f0+0.5(f1-f0)(tanh((t-torn)/(r/3)-3)+1) expression in order to change the frequency of the signal?
Can you please explain the meaning of the torn and r terms?
Maybe tuning f0 and f1 can be a way to explore a frequency range?
Best
Menica
adding noise to input
Re: adding noise to input
I would like to create an input signal like this:
i(t) = [is(t)+in(t)]+
I would like to positive part of the sum of
is(t)=A*sin(2PI(t-del)f/0.0001)+ i0
and
in(t) which is the noise part, solution of:
tau*noise' = -noise+sigma*sqrt(2*tau)eta(t)
where eta is a gaussian distribution
I wrote this code, but it is not working. Any help?
How can I take only the positive part of i?
This is the error I got:
Convergence not achieved in maximum number of iterations
/usr/local/nrn/x86_64/bin/nrniv: scopmath library error
near line 1
hoc_ac_ = num_estim
^
fadvance()
advance()
step()
continuerun(1300)
and others
i(t) = [is(t)+in(t)]+
I would like to positive part of the sum of
is(t)=A*sin(2PI(t-del)f/0.0001)+ i0
and
in(t) which is the noise part, solution of:
tau*noise' = -noise+sigma*sqrt(2*tau)eta(t)
where eta is a gaussian distribution
I wrote this code, but it is not working. Any help?
How can I take only the positive part of i?
Code: Select all
NEURON {
POINT_PROCESS periodicnoiseinput
RANGE i,del,dur,amp,std,f,v0,A,n, noise, sigma, tau
ELECTRODE_CURRENT i
}
UNITS {
(nA) = (nanoamp)
PI = (pi) (1)
}
PARAMETER {
del=50 (ms)
dur=1000 (ms)
std=0.2 (nA)
f (1/s) : frequency is in Hz
n (1)
v0 =1.5 (1/ms)
A=0.6 (1/ms)
sigma =0.001
tau=0.3 (ms)
}
ASSIGNED {
ival (nA)
i (nA)
amp (nA)
eta (nA)
on (1)
}
INITIAL {
i = 0
on = 0
net_send(del, 1)
}
STATE {
noise (nA)
}
PROCEDURE seed(x) {
set_seed(x)
}
BEFORE BREAKPOINT {
if (on) {
amp = v0 + A*sin(2*PI*(t-del)*f*(0.001))
SOLVE state METHOD derivimplicit
ival = amp + noise
} else {
ival = 0
}
}
BREAKPOINT {
i = ival
}
DERIVATIVE state {
eta = normrand(0,std*1(/nA))*1(nA)
noise' = (-noise +sigma*sqrt(2*tau)*eta)/tau
}
NET_RECEIVE (w) {
if (flag == 1) {
if (on == 0) {
: turn it on
on = 1
: prepare to turn it off
net_send(dur, 1)
} else {
: turn it off
on = 0
}
}
}
Convergence not achieved in maximum number of iterations
/usr/local/nrn/x86_64/bin/nrniv: scopmath library error
near line 1
hoc_ac_ = num_estim
^
fadvance()
advance()
step()
continuerun(1300)
and others