matlab fft简单小例子,matlabfft简单例子(A simple example of matlabfft).doc

matlabfft简单例子(A simple example of matlabfft)

matlabfft简单例子(A simple example of matlabfft)

N = 128;

N = 0: n - 1;

T = n/fs.

F0 = 10; % set the frequency of the sinusoidal signal

% generates sinusoidal signals

X = sin (2 * PI * f0 * t);

Figure (1);

Subplot (231);

The plot (t, x); The time domain waveform for sinusoidal signals

Xlabel (' t ');

Ylabel (' y ');

Title (' sine signal y = 2 * PI * 10t time domain waveform ');

The grid;

% carry FFT transform and do the spectrum

Y = FFT (x, N); I'm going to do the FFT transformation

Mag = abs (y); Amplitude % o

F = (0: length (y) - 1) '* fs/length (y); The corresponding frequency conversion is performed

Figure (1);

Subplot (232);

The plot (f, mag); % of the spectrum

The axis (,0,80 [0100]);

Xlabel (' frequency (Hz));

Ylabel (' amplitude);

Title (' sine signal y = 2 * PI * 10t spectrum diagram N = 128 ');

The grid;

MATLAB FFT program 2009-11-08 16:30 CLC

X % input signal

M = nextpow2 (x); The lowest power m of 2 for the length of x

N = 2 ^ M;

If length (x) < N

X = [x, zeros (1, N - length (x)]; If the length of x is not the power of 2, the integer power of 0 to 2

The end

An NXD = bin2dec (fliplr (dec2bin (1: N - 1, M))) + 1; 1:2 % o ^ M sequence number in the reverse order

Y = x (an NXD); % will arrange x in reverse order as the initial value of y

WN = exp (-i 2 * PI * / N);

For L = 1: M

B = 2 ^ L / 2; The two input data of each butterfly are separated by B points, each of which has B different rotation factors

For J = 0: B - 1 % J represents different rotation factors

P = J * 2 ^ (M - L);

WNp = WN ^ p;

For k = J + 1:2 ^ m: N % of this butterfly operation across the interval of 2 ^ L

KP = k + B; The relationship between the two factors corresponding to the unit subscript

T = y (KP) * WNp; The product of the % butterfly operation

Y (KP) = y (k) - t; % butterfly operation, you must first do the subtraction operation, then add operation, otherwise you will use the intermediate variable to pass y (k).

Y (k) = y (k) + t; % butterfly operation

The end

The end

The end

y

Y1 = FF

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值