summaryrefslogtreecommitdiff
path: root/macros/ifftn.sci
diff options
context:
space:
mode:
authorRashpat932024-08-09 11:47:44 +0530
committerGitHub2024-08-09 11:47:44 +0530
commitaf6fe82f90dcb2314a3d37a9a1e297fb0fc447f3 (patch)
tree80effebb59b2042de6635493f4831ba215f19eee /macros/ifftn.sci
parentb10cff2c07747b039e3c3ee83a34d437e958356b (diff)
parent2e21edde1c1a251a60739b15e1c699172401f044 (diff)
downloadFOSSEE-Signal-Processing-Toolbox-af6fe82f90dcb2314a3d37a9a1e297fb0fc447f3.tar.gz
FOSSEE-Signal-Processing-Toolbox-af6fe82f90dcb2314a3d37a9a1e297fb0fc447f3.tar.bz2
FOSSEE-Signal-Processing-Toolbox-af6fe82f90dcb2314a3d37a9a1e297fb0fc447f3.zip
Merge pull request #17 from avinashlalotra/masterHEADmaster
Abinash's Work
Diffstat (limited to 'macros/ifftn.sci')
-rw-r--r--macros/ifftn.sci69
1 files changed, 42 insertions, 27 deletions
diff --git a/macros/ifftn.sci b/macros/ifftn.sci
index 3d26c04..941dc67 100644
--- a/macros/ifftn.sci
+++ b/macros/ifftn.sci
@@ -1,27 +1,42 @@
-function y = ifftn(A, varargin)
-//Compute the inverse N-dimensional discrete Fourier transform of A using a Fast Fourier Transform (FFT) algorithm.
-//Calling Sequence
-//Y = ifftn(A)
-//Y = ifftn(A, size)
-//Parameters
-//A: Matrix
-//Description
-//Compute the inverse N-dimensional discrete Fourier transform of A using a Fast Fourier Transform (FFT) algorithm. The optional vector argument SIZE may be used specify the dimensions of the array to be used. If an element of SIZE is smaller than the corresponding dimension of A, then the dimension of A is truncated prior to performing the inverse FFT. Otherwise, if an element of SIZE is larger than the corresponding dimension then A is resized and padded with zeros.
-//Examples
-//ifftn([2,3,4])
-//ans =
-// 3. - 0.5 - 0.2886751i - 0.5 + 0.2886751i
-funcprot(0);
-funcprot(0);
-rhs = argn(2)
-if(rhs<1 | rhs>2)
-error("Wrong number of input arguments.");
-end
-
- select(rhs)
- case 1 then
- y = callOctave("ifftn",A);
- case 2 then
- y = callOctave("ifftn",A, varargin(1));
- end
-endfunction
+*/
+/*Description
+ Compute the inverse N-dimensional discrete Fourier transform of A using a Fast Fourier Transform (FFT) algorithm.
+ The optional vector argument SIZE may be used specify the dimensions of the matrix to be used.
+ If an element of SIZE is smaller than the corresponding dimension of A, then the dimension of A is truncated prior to performing the inverse FFT.
+ Otherwise, if an element of SIZE is larger than the corresponding dimension then A is resized and padded with zeros.
+Calling Sequence
+ Y = ifftn(A)
+ Y = ifftn(A, size)
+Parameters
+ A: Matrix
+ SIZE : (optional) dimension of matrix to be used
+Examples
+ ifftn([2,3,4])
+ ans =
+ 3. - 0.5 - 0.2886751i - 0.5 + 0.2886751i */
+function y = ifftn(A, SIZE)
+ funcprot(0);
+ funcprot(0);
+ rhs = argn(2)
+ if(rhs<1 | rhs>2)
+ error("Wrong number of input arguments.");
+ end
+ select(rhs)
+ case 1 then
+ y=fft(A,1);
+ case 2 then
+ // Check if A needs resizing
+ if size(A) == SIZE then
+ // No resizing needed
+ break;
+ elseif length(size(A)) ~= length(SIZE) then
+ error("Output size must have at least Ndims");
+ else
+ // Resize A using the resize_matrix function
+ A = resize_matrix(A, SIZE);
+ end
+ y = fft(A,1);
+ end
+ y = clean( y ) ;
+endfunction
+