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

조회 수: 11 (최근 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 CenterFile Exchange에서 Octave에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by