To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
The primary repository for this project is hosted at git://github.com/rmeddis/MAP.git .
This repository is a read-only copy which is updated automatically every hour.
root / testPrograms / myConv.m @ 18:e9e263e4fcde
History | View | Annotate | Download (1.04 KB)
| 1 |
signalDuration=.1; |
|---|---|
| 2 |
spikeTime= signalDuration/2; |
| 3 |
for sampleRate=[1000 2000]; |
| 4 |
disp(['sample rate= ' num2str(sampleRate)]) |
| 5 |
|
| 6 |
%% testing convolution speculation |
| 7 |
dt= 1/sampleRate; |
| 8 |
signalLength=round(signalDuration/dt); |
| 9 |
spikeArray=zeros(1,signalLength); |
| 10 |
spikeLocation=round(spikeTime/dt); |
| 11 |
spikeArray(spikeLocation)=1; |
| 12 |
disp(['length of spike array= ' num2str(length(spikeArray))]) |
| 13 |
t=dt*(1:length(spikeArray)); |
| 14 |
plot(t, spikeArray) |
| 15 |
|
| 16 |
%% convolution function |
| 17 |
CNspikeToCurrentTau=0.01; |
| 18 |
t=dt:dt:3*CNspikeToCurrentTau; |
| 19 |
CNalphaFunction=... |
| 20 |
(1/CNspikeToCurrentTau)*t.*exp(-t/CNspikeToCurrentTau); |
| 21 |
|
| 22 |
plot(t, CNalphaFunction) |
| 23 |
|
| 24 |
%% normalise conv function |
| 25 |
CNalphaFunction=CNalphaFunction/sum(CNalphaFunction); |
| 26 |
plot(t, CNalphaFunction) |
| 27 |
disp(['area under function= ' num2str(sum(CNalphaFunction))]) |
| 28 |
|
| 29 |
%% adjust for spike current |
| 30 |
CNcurrentPerSpike=2; |
| 31 |
CNalphaFunction=CNalphaFunction*CNcurrentPerSpike; |
| 32 |
plot(t, CNalphaFunction) |
| 33 |
|
| 34 |
%% convolution |
| 35 |
result=conv(spikeArray,CNalphaFunction); |
| 36 |
t=dt*(1:length(result)); |
| 37 |
plot(t, result) |
| 38 |
disp(['area under function= ' num2str(sum(result))]) |
| 39 |
|
| 40 |
end |
| 41 |
|
| 42 |
|
| 43 |
|