フィルターのクリア

Generate Real Signal With Random Phase and Specified Modulus at 10 Harmonics

4 ビュー (過去 30 日間)
Jeff
Jeff 2011 年 8 月 23 日
Hi all,
I want to create a 1 sec duration real signal with 10 harmonics of a specified modulus and randomized phase. Here's what I've done:
phase = [2*rand(1)*pi - pi, ... , 2*rand(1)*pi - pi]; % ... is 8 repetitions
modulus = [1000, ... , 1000]; % ... is 8 repetitions
real = sqrt(modulus.^2./([1,1,1,1,1,1,1,1,1,1]+tan(phase).^2)); % substitute and calculate real part first
imag = sqrt(modulus.^2 - real.^2); % solve for imag part
sigfft = zeros(44100,1);
for i = 1:10
sigfft(1+200*i) = real(i) + j*imag(i); % j = sqrt(-1) previously assigned
sigfft(44100+1-200*i) = real(i) + j*imag(i);
end
sig = ifft(sigfft);
Thus, I assign a random phase in the interval [-pi,pi), and find the imaginary and real parts which correspond to the assigned random phase and the specified modulus of 1000. Then I code these into the 10 harmonic bins of 200Hz, 400Hz, ... , 2000Hz. However, when I execute sig = ifft(sigfft), Matlab returns a complex signal. I want a real signal, what's going on here?
  1 件のコメント
Jeff
Jeff 2011 年 8 月 23 日
I think I may have figured out the answer. I need to use the complex conjugate for the sigfft(44100+1-200*i) assignment.

サインインしてコメントする。

回答 (1 件)

Jeff
Jeff 2011 年 8 月 23 日
The answer was to use the complex conjugate for the sigfft(44100+1-200*i) assignment. Now sig is a real signal.

カテゴリ

Help Center および File ExchangeDirection of Arrival Estimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by