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

on 26 Mar 2013

### Wayne King (view profile)

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

Walter Roberson

### Walter Roberson (view profile)

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

### Wayne King (view profile)

on 26 Mar 2013
Edited by Wayne King

### Wayne King (view profile)

on 26 Mar 2013

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).

Dave

### Dave (view profile)

on 26 Mar 2013
Thank You. Your answer is exactly what I was looking for and helped me a lot.
Cheers