forked from sgarrettroe/data_analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpetersfft3.m
43 lines (38 loc) · 947 Bytes
/
petersfft3.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
function S=petersfft3(V,n)
len = size(V,1);
method = 'linear';
%method = 'spline';
%rows
%disp('rows')
for i = 1:len,
for j = 1:len
v = V(j,:,i);
vi = interp1([v v(end)],linspace(1,len+(n-1)/n,len*n),method);
%vi = interp1(v,linspace(1,len,len*n));
w = fft(vi);
V(j,:,i) = [w(1:len/2) w(end-len/2+1:end)];
end
end
%columns
%disp('cols')
for i = 1:len,
for j = 1:len
v = V(:,j,i);
vi = interp1([v; v(end)],linspace(1,len+(n-1)/n,len*n),method);
%vi = interp1(v,linspace(1,len,len*n));
w = fft(vi);
V(:,j,i) = [w(1:len/2) w(end-len/2+1:end)];
end
end
%pages
%disp('pages')
for i = 1:len,
for j = 1:len
v = squeeze(V(i,j,:));
vi = interp1([v; v(end)],linspace(1,len+(n-1)/n,len*n),method);
%vi = interp1(v,linspace(1,len,len*n));
w = fft(vi);
V(i,j,:) = [w(1:len/2) w(end-len/2+1:end)];
end
end
S=V;