-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirst_spec.m
More file actions
41 lines (28 loc) · 802 Bytes
/
Copy pathfirst_spec.m
File metadata and controls
41 lines (28 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
%% MT SPECGRAM
function [spec]=first_spec(eegch,tstartstop,samprate)
ds=1; %%downsampling if wanted
W=2;
T=1; %%secs
p=1;
t= (2*T*W)-p
movingwin=[T 0.2];
params.tapers= [W T p];
params.pad=1;
params.fpass=[0 80];
params.trialave=1;
%load channel for FFT
csc = eegch;
ts = 1/samprate:1/samprate:length(eegch)/samprate;
%load channel data
%[csc0, ts0, info0] = load_open_ephys_data([dn '\' fn]);
% downsampled
%csc = downsample(csc0,ds);
%ts = downsample(ts0,ds);
[ind]=find_in_interval(tstartstop, ts);
% filter the raw traces
% [cscf] = eegfilt(csc,200,1,100);
params.Fs=samprate;
[S,t,f]=mtspecgramc(csc(ind),movingwin,params);
spec.S=S;
spec.t=t;
spec.f=f;