problem with fft

1 回表示 (過去 30 日間)
itsik
itsik 2011 年 5 月 19 日
hello i have this program that make ifft for some random vary maybe someone can help me with the fft? thanks
N=10;
fs=1e6;
T=1e-3;
% random signal
bit=randint(20,1); % 20 bits 0 or 1 1 x 20
% serial-to-parallel converter
par=reshape(bit,2,10); % 2 x 10 2 bits for sym
% mapper
sym=par'*[2;1]; % multiplay for mapper 00-0 01-1 10-2 11-3
phase=[-3*pi/4,3*pi/4,-pi/4,pi/4];
phase_sym=phase(sym+1); % every sym gets phase for example pi/4 will get '3'
% IFFT
for k=0:N-1
i=1;
for t=1/fs:1/fs:T
x(k+1,i)=cos((2*pi*k*t)/T+phase_sym(k+1))+j*sin((2*pi*k*t)/T+phase_sym(k+1));
i=i+1;
end
end

採用された回答

Arturo Moncada-Torres
Arturo Moncada-Torres 2011 年 5 月 20 日
Why don't you use MATLAB's fft and ifft functions directly?
EDIT
For example, if you want it to have a length of 1000, it is very easy:
% Suppose "x" is the signal you want
x_fft = fft(x, 1000);
x_mag = abs(x_fft); % Magnitude
x_pha = angle(x_fft); % Phase

その他の回答 (2 件)

itsik
itsik 2011 年 5 月 20 日
cause i need the length of the fft will be 1000 do u know how i make it? with fft?

itsik
itsik 2011 年 5 月 20 日
maybe someone's know? or how to replace all this code in ifft command?

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by