DSPRelated.com
Forums

chirp linearity using Hilbert Transforms

Started by shital June 23, 2009
clear all;
Fs = 1000;		% Sampling frequency
T = 2;			% Signal time duration is 2 seconds.
t=0:1/Fs:T;                 
f0 = 50;                % Initial frequency is 50hz
f1 = 100;               % f(t) changes from 50hz to 100Hz in 2 seconds.

freq = f0 + (f1-f0)/T*t;

y = sin(2*pi*freq.*t);  % Chirp signal y(t)

Fs = 1000;		% Sampling frequency
T = 2;			% Signal time duration is 2 seconds.
t=0:1/Fs:T;                 
f0 = 50;                % Initial frequency is 50hz
f1 = 100;               % f(t) changes from 50hz to 100Hz in 2 seconds.

freq = f0 + (f1-f0)/T*t;

y = sin(2*pi*freq.*t);  % Chirp signal y(t)

figure(1); plot(t, freq); 

% Spectrum Plot of y(t)
N_FFT = 1024;           % Number of FFT points
y_FFT = fft(y,N_FFT);
f = round(Fs*(0:N_FFT/2)/N_FFT);           % Frequency scaling 
figure(2); plot(f, 20*log10(abs(y_FFT(1:N_FFT/2+1))))

% Hilbert tranform for instantaneous frequency recovery
output = y;
output_h = hilbert(output);
theta = angle(output_h);
ins_freq = diff(unwrap(theta));
figure; plot((1:1:length(ins_freq))/Fs, ins_freq*Fs/2/pi);


--------------------------------------------------------------------

Hi all,
The above code generates a chirp from 50 Hz to 100 Hz, I then use Hilbert
Transforms to evaluate the instantaneous frequency. When I plot the
ins_frequency, the chirp is twice the one generated, 50 Hz to 150 Hz. The
chirp width is become twice, which is wrong. Can someone help me why this
is happening.

Regards,
Shital


On Jun 23, 9:45=A0pm, "shital" <s.de...@acfr.usyd.edu.au> wrote:
> clear all; > Fs =3D 1000; =A0 =A0 =A0 =A0 =A0 =A0 =A0% Sampling frequency > T =3D 2; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0% Signal time duration is 2 s=
econds.
> t=3D0:1/Fs:T; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 > f0 =3D 50; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0% Initial frequency is 50hz > f1 =3D 100; =A0 =A0 =A0 =A0 =A0 =A0 =A0 % f(t) changes from 50hz to 100Hz=
in 2 seconds.
> > freq =3D f0 + (f1-f0)/T*t; > > y =3D sin(2*pi*freq.*t); =A0% Chirp signal y(t) > > Fs =3D 1000; =A0 =A0 =A0 =A0 =A0 =A0 =A0% Sampling frequency > T =3D 2; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0% Signal time duration is 2 s=
econds.
> t=3D0:1/Fs:T; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 > f0 =3D 50; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0% Initial frequency is 50hz > f1 =3D 100; =A0 =A0 =A0 =A0 =A0 =A0 =A0 % f(t) changes from 50hz to 100Hz=
in 2 seconds.
> > freq =3D f0 + (f1-f0)/T*t; > > y =3D sin(2*pi*freq.*t); =A0% Chirp signal y(t) > > figure(1); plot(t, freq); > > % Spectrum Plot of y(t) > N_FFT =3D 1024; =A0 =A0 =A0 =A0 =A0 % Number of FFT points > y_FFT =3D fft(y,N_FFT); > f =3D round(Fs*(0:N_FFT/2)/N_FFT); =A0 =A0 =A0 =A0 =A0 % Frequency scalin=
g
> figure(2); plot(f, 20*log10(abs(y_FFT(1:N_FFT/2+1)))) > > % Hilbert tranform for instantaneous frequency recovery > output =3D y; > output_h =3D hilbert(output); > theta =3D angle(output_h); > ins_freq =3D diff(unwrap(theta)); > figure; plot((1:1:length(ins_freq))/Fs, ins_freq*Fs/2/pi); > > -------------------------------------------------------------------- > > Hi all, > The above code generates a chirp from 50 Hz to 100 Hz, I then use Hilbert > Transforms to evaluate the instantaneous frequency. When I plot the > ins_frequency, the chirp is twice the one generated, 50 Hz to 150 Hz. The > chirp width is become twice, which is wrong. Can someone help me why this > is happening. > > Regards, > Shital
As you noted the instantaneous frequency is given by the derivative of the phase. The derivative of t^2 is 2t , which introduces another factor of 2 in the frequency resulting in twice the bandwidth In your case let A =3D (100-50)/2 =3D 25 Hz/sec (chirp rate) If you set phase =3D A*t^2 (note units are radians) then the frequency =3D 2At. Which results in twice the bandwidth. Normally you see it as sin(2*pi*fo*t +pi*A*t.^2) Cheers, David