-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_fft.m
48 lines (40 loc) · 1.11 KB
/
plot_fft.m
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
42
43
44
45
46
47
function hout = plot_fft(power, freq, y_lim, grid_x)
% plot_fft plot powerspectrum of relevance to frequency tagging
%
% h = plot_fft(power, freq, y_lim, grid_x)
%
% power one row of data (e.g. as returned by calc_fft)
% f frequency axis
% y_lim optional. specifies y limits of plot. also use default if = []
% grid_x optional. specifies guidelines do draw to indicate freqs
%
% h handle to line
%
% JRI, split from calc_fft, 1/27/03
%if size(power,1) > 1,
% disp('multirow result, only plotting first')
%end
%yy = power(1,:);
yy = power;
if nargin >= 3 && ~isempty(y_lim),
y_tic = [y_lim(1) 0.5*y_lim(2)];
else
y_tic = [min(min(yy(:,2:end))) 0.5*max(max(yy(:,2:end)))]; %max of non-dc terms
y_lim = [0 max(max(yy(:,25:end)))]; %max of non-dc terms
end
if nargin < 4,
grid_x = [1 3.16 10 20 30 40]; %appropriate for MEG, tags
grid_x = [];
end
plotgrid(grid_x,y_tic,[],[]);
hold on
set(gca,'tickdir','out')
h = plot(freq, yy,'k-');
%semilogy(freq(pos_idx), yy,'k-')
ylim(y_lim)
xlim([0 65])
ylabel('PSD')
xlabel('Frequency')
if nargout,
hout = h;
end