📄 fftmn.m
字号:
function y =fftmn(x,R,C)
%FFTMN FFT of a data set from fft of its smaller subsets
% y=fftmn(x,R,C) FFT of x using fft of R rows and C columns
% Length(x) must equal RC
%
% If no input arguments are given, the following example is used
% Find fft of z=[1:12] using 4 rows and 3 columns and compute error
% z=(1:12)';Z=fft(z);Zmn=fftmn(z,4,3);err=Z-Zmn
% ADSP Toolbox: Version 2.0
% For use with "Analog and Digital Signal Processing", 2nd Ed.
% Published by PWS Publishing Co.
%
% Ashok Ambardar, EE Dept. MTU, Houghton, MI 49931, USA
% http://www.ee.mtu/faculty/akambard.html
% e-mail: akambard@mtu.edu
% Copyright (c) 1998
if nargin==0,help fftmn,disp('Strike a key for results of the example'),pause
z=(1:12)';Z=fft(z);Zmn=fftmn(z,4,3);err=Z-Zmn,return,end
N=length(x);
if nargin<3, C=1;end
if nargin<2, R=N;end
if N~=R*C,error('length(data) must equal (rows)*(columns)'),return,end
%Reshape x into an RxC matrix (fill along columns)
y=reshape(x,R,C);
%Replace each row by its DFT times W_r=exp(-j*2*pi*r*c/N)
%where r=0 for first row, r=1 for second row etc and c=0:C-1; for each row
for k=1:R
y(k,:)=fft(y(k,:)).*exp(-j*2*pi*(k-1)*(0:C-1)/N);
end
%Now, replace each column by its DFT.
for k=1:C
y(:,k)=fft(y(:,k));
end
%Read out the result by rows
y=y.';y=reshape(y,size(x));
%y=y(:); %Convert to columns
%[row,col]=size(x);
%if row==1,y=y.';end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -