MATLAB Answers

Dave
0

How to apply 90 degrees phase shift to a voice signal.?

Asked by Dave
on 26 Mar 2013

Dear all,

I have a voice signal a. Lets say its a sine with x Hz.

Length and sampling frequency are writen below:

fs = 100000;                  % Sampling frequency
T = 1/fs;                     % Sample time
L = 100000;                   % Length of signal
t = (0:L-1)*T;                % Time vector (s)

Here is the FFT of this signal in Hertz

NFFT = 2^nextpow2(L); 
ff = fs/2*linspace(0,1,NFFT/2+1);
A = fft(a,NFFT)/L;
plot(ff,2*abs(A(1:NFFT/2+1)));xlabel('freq (Hz)');
ylabel('|A(f)| ');grid

How can we apply a 90 degrees phase shift to this signal-a? Actually, we can estimate its type, frequency and amplitude by plotting it in time and freq. domain and then we can write it as something(2*pi*x*t). Then of course, shifted wave will become something(2*pi*x*t+pi/2). But we need a code that directly shift its phase 90 degrees.

Best regards Dave

  1 Comment

Multiply the complex frequency entries by (1 + pi/2*i) ?

Sign in to comment.

1 Answer

Answer by Wayne King
on 26 Mar 2013
Edited by Wayne King
on 26 Mar 2013
 Accepted Answer

If you have the Signal Processing Toolbox, you can use hilbert() to obtain the analytic signal and use the imaginary part.

    n = 0:159;
    x = cos(pi/4*n);
    y = hilbert(x);
    plot(n,x,'b'); hold on;
    plot(n,imag(y),'r');

Note that with a frequency of pi/4 radians/sample, a phase shift of pi/2 is 2 samples, which is exactly what you get in imag(y).

  1 Comment

Thank You. Your answer is exactly what I was looking for and helped me a lot.

Cheers

Sign in to comment.


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today