diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /125/DEPENDENCIES/fft2d.sce | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '125/DEPENDENCIES/fft2d.sce')
-rwxr-xr-x | 125/DEPENDENCIES/fft2d.sce | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/125/DEPENDENCIES/fft2d.sce b/125/DEPENDENCIES/fft2d.sce new file mode 100755 index 000000000..7cb43b663 --- /dev/null +++ b/125/DEPENDENCIES/fft2d.sce @@ -0,0 +1,25 @@ +function [a2] = fft2d(a)
+//a = any real or complex 2D matrix
+//a2 = 2D-DFT of 2D matrix 'a'
+m=size(a,1)
+n=size(a,2)
+// fourier transform along the rows
+for i=1:n
+a1(:,i)=exp(-2*%i*%pi*(0:m-1)'.*.(0:m-1)/m)*a(:,i)
+end
+// fourier transform along the columns
+for j=1:m
+a2temp=exp(-2*%i*%pi*(0:n-1)'.*.(0:n-1)/n)*(a1(j,:)).'
+a2(j,:)=a2temp.'
+end
+for i = 1:m
+ for j = 1:n
+ if((abs(real(a2(i,j)))<0.0001)&(abs(imag(a2(i,j)))<0.0001))
+ a2(i,j)=0;
+ elseif(abs(real(a2(i,j)))<0.0001)
+ a2(i,j)= 0+%i*imag(a2(i,j));
+ elseif(abs(imag(a2(i,j)))<0.0001)
+ a2(i,j)= real(a2(i,j))+0;
+ end
+ end
+end
\ No newline at end of file |