0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 pname='data';
0039 params.Fs=1000;
0040 params.fpass=[10 100];
0041 params. tapers=[3 5];
0042 params.pad=2;
0043 params.err=[2 0.05];
0044 params.trialave=1;
0045 movingwin=[0.5 0.05];
0046 segave=1;
0047 direction=5;
0048
0049 wintrig=[5*movingwin(1) 5*movingwin(1)];
0050 winseg=2*movingwin(1);
0051
0052
0053
0054 eval(['load LIPdata.mat']);
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066 NT=round(params.Fs*10*movingwin(1));
0067 data=dlfp(1:NT,:); data1=data(:,1:2);
0068 [S,f,Serr]=mtspectrumc(data1,params);
0069 figure;
0070 plot(f,10*log10(S),f,10*log10(Serr(1,:)),f,10*log10(Serr(2,:))); xlabel('Frequency Hz'); ylabel('Spectrum');
0071
0072
0073
0074 phi=[0 pi/2];
0075 [dS,f]=mtdspectrumc(data1,phi,params);
0076 figure;
0077 plot(f,dS(1,:),f,dS(2,:)); xlabel('frequency Hz'); ylabel('Derivatives'); legend('Time','Frequency');
0078
0079
0080
0081 data1=data(:,1:2);data2=data(:,3:4);
0082 [C,phi,S12,S1,S2,f,confC,phierr,Cerr]=coherencyc(data1,data2,params);
0083 figure;plot(f,C,f,Cerr(1,:),f,Cerr(2,:));xlabel('frequency'); ylabel('Coherency');
0084
0085
0086
0087 [C,phi,S12,f,confC,phierr,Cerr]=cohmatrixc(data1,params);
0088
0089
0090 [S,t,f,Serr]=mtspecgramc(data1,movingwin,params);
0091 figure;imagesc(t,f,10*log10(S)'); axis xy; colorbar
0092
0093
0094
0095 phi=[0 pi/2];
0096 [dS,t,f]=mtdspecgramc(data1,movingwin,phi,params);
0097
0098
0099
0100
0101
0102
0103 NT=round(movingwin(1)*Fs);
0104 [C,phi,S12,S1,S2,t,f,confC,phierr,Cerr]=cohgramc(data1,data2,movingwin,params);
0105 figure;imagesc(t,f,C'); axis xy; colorbar;
0106
0107
0108
0109 NT=10*round(winseg*Fs);
0110 data1=dlfp(1:NT,1);
0111 [S,f,varS,C,Serr]=mtspectrumsegc(data1,winseg,params,segave);
0112 figure; subplot(211);plot(f,10*log(S));
0113 imagesc(f,f,C); axis xy;colorbar;
0114
0115
0116
0117 NT=10*round(winseg*Fs);
0118 data1=dlfp(1:NT,1); data2=dlfp(1:NT,2);
0119 [C,phi,S12,S1,S2,f,confC,phierr,Cerr]=coherencysegc(data1,data2,winseg,params);
0120 figure; subplot(311); plot(f,C);subplot(312); plot(f,10*log10(S1)); subplot(313);plot(f,10*log10(S2))
0121
0122
0123
0124 E1=targon(find(targets==direction));
0125 data1=dlfp(:,1);
0126 [S,f,Serr]=mtspectrumtrigc(data1,E1,wintrig,params);
0127 figure;plot(f,10*log10(S)'); axis xy; colorbar;
0128
0129
0130
0131 E1=targon(find(targets==direction));
0132 data1=dlfp(:,1);
0133 [S,t,f,Serr]=mtspecgramtrigc(data1,E1,wintrig,movingwin,params);
0134 figure; imagesc(t,f,10*log10(S)'); axis xy; colorbar;
0135
0136
0137
0138
0139
0140
0141
0142
0143 data=extractdatapt(dsp,[20 30]);
0144 [S,f,R,Serr]=mtspectrumpt(data,params);
0145 figure; plot(f,10*log10(S),f,10*log10(Serr(1,:)),f,10*log10(Serr(2,:)));line(get(gca,'xlim'),[10*log10(R) 10*log10(R)]);
0146
0147
0148
0149
0150
0151 phi=[0 pi/2];
0152 [dS,f]=mtdspectrumpt(data,phi,params);
0153 figure; plot(f,dS);
0154
0155
0156
0157
0158
0159 data=extractdatapt(dsp,[20 30]);
0160 data1=data(1); data2=data(2);fscorr=[];t=[];
0161 [C,phi,S12,S1,S2,f,zerosp,confC,phierr,Cerr]=coherencypt(data1,data2,params);
0162 figure; plot(f,C);
0163
0164
0165
0166
0167
0168 E1=targon(find(targets==direction));
0169 data=dsp(1);
0170 [S,f,R,Serr]=mtspectrumtrigpt(data,E1,wintrig,params);
0171 figure;plot(f,10*log10(S),f,10*log10(Serr(1,:)),f,10*log10(Serr(2,:))); line(get(gca,'xlim'),[10*log10(R) 10*log10(R)]);
0172
0173
0174
0175
0176
0177 data=extractdatapt(dsp,[20 30]);
0178 [C,phi,S12,f,zerosp,confC,phierr,Cerr]=cohmatrixpt(data,params,fscorr);
0179
0180
0181
0182
0183 data=createdatamatpt(dsp(1),E1,wintrig);
0184 [S,t,f,R,Serr]=mtspecgrampt(data,movingwin,params);
0185 figure;imagesc(t,f,10*log10(S)'); axis xy; colorbar;
0186
0187
0188
0189
0190
0191 data=createdatamatpt(dsp(1),E1,wintrig);
0192 phi=[0 pi/2];
0193 [dS,t,f]=mtdspecgrampt(data,movingwin,phi,params);
0194 figure; subplot(211); imagesc(t,f,squeeze(dS(1,:,:))'); axis xy; colorbar;
0195 subplot(212); imagesc(t,f,squeeze(dS(2,:,:))'); axis xy; colorbar;
0196
0197
0198
0199
0200 data1=createdatamatpt(dsp(1),E1,wintrig);
0201 data2=createdatamatpt(dsp(2),E1,wintrig);
0202 [C,phi,S12,S1,S2,t,f,zerosp,confC,phierr,Cerr]=cohgrampt(data1,data2,movingwin,params,fscorr);
0203 figure;imagesc(t,f,C');axis xy; colorbar
0204
0205
0206
0207
0208
0209 data=dsp(1);
0210 [S,t,f,R,Serr]=mtspecgramtrigpt(data,E1,wintrig,movingwin,params);
0211 imagesc(t,f,10*log10(S)'); axis xy; colorbar
0212
0213
0214
0215 data=extractdatapt(dsp,[20 30]);
0216 data=data(1);
0217 [S,f,R,varS]=mtspectrumsegpt(data,winseg,params);
0218 plot(f,10*log10(S)); line(get(gca,'xlim'),[10*log10(R) 10*log10(R)]);
0219
0220
0221
0222 data=extractdatapt(dsp,[20 30]);
0223 data1=data(1);data2=data(2);
0224 [C,phi,S12,S1,S2,f,zerosp,confC,phierr,Cerr]=coherencysegpt(data1,data2,winseg,params);
0225 figure; subplot(311); plot(f,C);subplot(312); plot(f,10*log10(S1));subplot(313); plot(f,10*log10(S2))
0226
0227
0228
0229 offset=1;
0230 data1=dlfp(20000:30000,1); data2=extractdatapt(dsp,[20 30],offset);data2=data2(1).times;
0231 [C,phi,S12,S1,S2,f,zerosp,confC,phierr,Cerr]=coherencycpt(data1,data2,params);
0232 figure; subplot(311); plot(f,C);subplot(312); plot(f,10*log10(S1));subplot(313); plot(f,10*log10(S2))
0233
0234
0235 data1=dlfp(20000:30000,1); data2=extractdatapt(dsp,[20 30],offset);data2=data2(1).times;
0236 [C,phi,S12,S1,S2,f,zerosp,confC,phierr,Cerr]=coherencysegcpt(data1,data2,winseg,params,segave,fscorr);
0237 figure; subplot(311); plot(f,C);subplot(312); plot(f,10*log10(S1));subplot(313); plot(f,10*log10(S2))
0238
0239
0240 data1=dlfp(20000:30000,1); data2=extractdatapt(dsp,[20 30],offset);data2=data2(1).times;
0241 [C,phi,S12,S1,S2,t,f,zerosp,confC,phierr,Cerr]=cohgramcpt(data1,data2,movingwin,params,fscorr);
0242 figure; subplot(311); imagesc(t,f,C');axis xy; colorbar; subplot(312);imagesc(t,f,10*log10(S1)');axis xy; colorbar; subplot(313); imagesc(t,f,10*log10(S2)');axis xy; colorbar
0243
0244
0245
0246
0247 [dN,t]=binspikes(dsp,params.Fs,[20 30]);
0248
0249 data=dN;
0250 [S,f,R,Serr]=mtspectrumpb(data,params);
0251 plot(f,10*log10(S),f,10*log10(Serr(1,:)), f,10*log10(Serr(2,:)));
0252
0253 data=dN;
0254 phi=[0 pi/2];
0255 [dS,f]=mtdspectrumpb(data,phi,params);
0256 figure; plot(f,dS);
0257
0258 data=dN;
0259 data1=data(:,1); data2=data(:,2);fscorr=[];t=[];
0260 [C,phi,S12,S1,S2,f,zerosp,confC,phierr,Cerr]=coherencypb(data1,data2,params);
0261 figure; subplot(311); plot(f,C);subplot(312); plot(f,10*log10(S1)); subplot(313); plot(f,10*log10(S2));
0262
0263 E=targon(find(targets==direction)); E=E(find(E>20 & E<450)); [dN,t]=binspikes(dsp,params.Fs,[20 500]);data=dN(:,1);
0264 [S,f,R,Serr]=mtspectrumtrigpb(data,E,wintrig,params);
0265 figure;plot(f,10*log10(S),f,10*log10(Serr(1,:)),f,10*log10(Serr(2,:)));
0266
0267 [dN,t]=binspikes(dsp,params.Fs,[20 30]);
0268 data=dN;
0269 [C,phi,S12,f,zerosp,confC,phierr,Cerr]=cohmatrixpb(data,params,fscorr);
0270
0271 [dN,t]=binspikes(dsp,params.Fs,[20 30]);
0272 data=dN;
0273 [S,t,f,R,Serr]=mtspecgrampb(data,movingwin,params);
0274 figure;imagesc(t,f,10*log10(S)'); axis xy; colorbar
0275
0276 clear R Serr Cerr S C phierr dN dS data1 data2
0277
0278 [dN,t]=binspikes(dsp,params.Fs,[20 30]);
0279 data=dN;
0280 phi=[0 pi/2];
0281 [dS,t,f]=mtdspecgrampb(data,movingwin,phi,params);
0282
0283 [dN,t]=binspikes(dsp,params.Fs,[20 30]);
0284 data=dN;
0285 data1=data(:,1); data2=data(:,2);
0286 [C,phi,S12,S1,S2,t,f,zerosp,confC,phierr,Cerr]=cohgrampb(data1,data2,movingwin,params,fscorr);
0287
0288 [dN,t]=binspikes(dsp,params.Fs);
0289 dN=dN(:,1);
0290 E=E(1:6);
0291 data=dN;
0292 [S,t,f,R,Serr]=mtspecgramtrigpb(data,E,wintrig,movingwin,params);
0293
0294 [dN,t]=binspikes(dsp,params.Fs,[20 30]);
0295 data=dN;
0296 data=data(:,1);
0297 [S,f,R,varS]=mtspectrumsegpb(data,winseg,params,segave,fscorr);
0298 figure; plot(f,10*log10(S)); line(get(gca,'xlim'),10*log10([R R]));
0299
0300 [dN,t]=binspikes(dsp,params.Fs,[20 30]);
0301 data=dN;
0302 data1=data(:,1);data2=data(:,2);
0303 [C,phi,S12,S1,S2,f,zerosp,confC,phierr,Cerr]=coherencysegpb(data1,data2,winseg,params);
0304
0305
0306
0307
0308 data1=dlfp(20000:30000,:);data1=data1(:,1:2); [dN,t]=binspikes(dsp,params.Fs,[20 30]);
0309 data2=dN; data2=data2(1:end,:);
0310 [C,phi,S12,S1,S2,f,zerosp,confC,phierr,Cerr]=coherencycpb(data1,data2,params);
0311
0312 data1=data1(:,1); data2=data2(:,1);
0313 [C,phi,S12,S1,S2,f,zerosp,confC,phierr,Cerr]=coherencysegcpb(data1,data2,winseg,params,segave,fscorr);
0314
0315
0316 data1=dlfp(20000:30000,:); data1=data1(:,1:2);
0317 [dN,t]=binspikes(dsp,params.Fs,[20 30]);
0318 data2=dN; data2=data2(1:end,:);
0319 [C,phi,S12,S1,S2,t,f,zerosp,confC,phierr,Cerr]=cohgramcpb(data1,data2,movingwin,params,fscorr);
0320