12345678910111213141516171819202122232425262728293031323334 |
- function [STA_mean_normalized,STA_mean]=buildSTA ...
- (stim_signal,membraneP,STA_fnbr)
- % [STA_mean_normalized,STA_mean]=buildSTA ...
- % (stim_signal,membraneP,STA_fnbr)
- %is getting the contrast value that happen before each response
- %and multiplies them with the average membrane Potential per frame.
- % INPUT: stim_signal -> stimulus signal containing the contrast values in 2D
- % membraneP -> membrane potential average per frame
- % STA_fnbr -> nbr of frames you go back in time
- % OUTPUT: STA_mean_normalized -> normalized STA, relevant for
- % computing the NL
- % STA_mean -> not normalized STA
- %------------------------------------------------------------------------------------------
- %% 1. Loop over all membrane potential values
- STA_fnbr=STA_fnbr-1; %the first value is one frame, so to take exactly 10 frames, substract one here.
- for kk=1:length(membraneP)-(STA_fnbr)
- if kk==1
- signal1=membraneP(kk+(STA_fnbr))*stim_signal(:,kk:kk+(STA_fnbr)); %multiply the average values with the stimulus signal before; it start now from 1 and goes until the element kk
- else
- signal2=membraneP(kk+(STA_fnbr))*stim_signal(:,kk:kk+(STA_fnbr)); %multiply the average values with the stimulus signal before
- signal1=signal1+signal2; %make the sum to get the average at the end
- clear signal2;
- end
- end
- %build the average
- STA_mean=signal1/length(1:length(membraneP)-(STA_fnbr)); %not normalized
- %normalize
- STA_mean_normalized = STA_mean(:) / sqrt(sum(STA_mean(:).*STA_mean(:))); %relevant for computing the NL
- STA_mean_normalized=reshape(STA_mean_normalized,size(STA_mean));
- end
|