fft_model.m

来自「OFDM的fpga实现」· M 代码 · 共 47 行

M
47
字号
%    function [y] = fft_model(x,nps,inverse)             %                                                                                             %   Calculates the complex fixed-point FFT/IFFT for variable transform%   sizes (stored in vector nps) of the complex input vector x.%%   Uses the fixed point model of the Variable Streaming architecture.%                                                                                             %   Inputs:   x          : Input complex vector. x will be split into blocks%                          of various sizes as specified by nps. The size of this%                          vector must greater than or equal to the sum of the%                          values in nps.%                          appended to the input sequence appropriately.                      %             nps        : A vector of transform Lengths to be applied on a block-by-block basis.                %             inverse    : A vector specifying the FFT direction on a block-by-block basis.   %                          0 => FFT                                                           %                          1 => IFFT%                                                                                             %   Outputs   y          : The transform-domain complex vector output                         %                                                     %                                                                                             %   2001-2007 Altera Corporation, All Rights Reserved%                                                                                                  %   Automatically Generated: FFT MegaCore Function 7.1 Build 177 May, 2007                                                                                                   %function [y] = fft_model(x,nps,inverse)         addpath('c:/altera/71sp1/ip/fft/lib//ip_toolbench//../');% Parameterization Space    N=2048;DATA_PREC=16;TWIDDLE_PREC=16;% Input is in natural order                                                           INPUT_ORDER=1;  % Output is in bit-reversed orderOUTPUT_ORDER=0;                                                         y=[];           i=1;%for each block in the vector N, perform the transformfor i=1:length(nps)                                                                          rin = real(x(1:nps(i)));                                                              iin = imag(x(1:nps(i)));                                                                           [roc,ioc] = SVSfftmodel(rin,iin,DATA_PREC,TWIDDLE_PREC,N,nps(i),inverse(i), INPUT_ORDER, OUTPUT_ORDER);          y = [y, roc+j*ioc]   ;    %remove block from input vector    x=x(nps(i)+1:end);  end                                                                                           

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?