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

11 vues (au cours des 30 derniers jours)
Jeff
Jeff le 23 Août 2011
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 commentaire
Jeff
Jeff le 23 Août 2011
I think I may have figured out the answer. I need to use the complex conjugate for the sigfft(44100+1-200*i) assignment.

Connectez-vous pour commenter.

Réponses (1)

Jeff
Jeff le 23 Août 2011
The answer was to use the complex conjugate for the sigfft(44100+1-200*i) assignment. Now sig is a real signal.

Catégories

En savoir plus sur Octave dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by