-1
$\begingroup$

Let $s(t)$ be a complex signal. I would like to know how to find a signal from its instantaneous frequency. I programmed the following function which calculates the instantaneous frequency.

function [f]=instfreq(s)

z=unwrap(angle(s));
f=diff(z)/(2*pi);

end

Example on a chirp:

clear all;close all;clc;

B=20e3;
fs=100e3;
T=10e-3;

%% LFM
t=(0:T*fs-1)*(1/fs);
lfm=exp(1i*2*pi*(-(B/2)*t+(B/(2*T))*t.^2));

%% Instantaneous frequency
[f]=instfreq(lfm);
f=[f f(end)]; %adding an element to have the same length as t

%% Signal reconstruction
phi=cumtrapz(t,f);
sig=exp(1i*2*pi*phi);

plot(abs(fftshift(fft(sig))))

We cannot find the starting chirp ($sig \neq lfm$). For example, the spectrum of the reconstructed signal is not the same. Its bandwidth is not $20$ kHz.

$\endgroup$
2
  • 1
    $\begingroup$ So remove the call to hilbert and just pass s in as y. hilbert changes a real-valued signal to a complex-valued signal. The signal lfm is already complex-valued. $\endgroup$
    – Peter K.
    Commented Mar 25 at 20:59
  • $\begingroup$ I agree with you. However, I still have a problem. Once I have found the instantaneous frequency, I can do the opposite operation to find the chirp. However, this is not the case here, I cannot find the starting chirp. I use the cumtrapz(t,f) command for integration and normally I have to find the chirp phase. $\endgroup$
    – bubu
    Commented Mar 26 at 10:17

1 Answer 1

0
$\begingroup$

This line

[f]=instfreq(lfm);

should be

[f]=instfreq(lfm)*fs;

If I do that and plot the true $\phi$ and the estimated $\phi$ then they overlap:

Parabolic plot of both phases


Code Below

clear all;
clc;

B=20e3;
fs=100e3;
T=10e-3;

%% LFM
t=(0:T*fs-1)*(1/fs);
true_phi = 2*pi*(-(B/2)*t+(B/(2*T))*t.^2);
lfm=exp(1i*true_phi);

%% Instantaneous frequency
[f]=instfreq(lfm)*fs;
f=[f f(end)]; %adding an element to have the same length as t

%% Signal reconstruction
est_phi=cumtrapz(t,f);
sig=exp(1i*est_phi);

plot(true_phi,'.');
hold on;
plot(est_phi,'r');
hold off;

$\endgroup$
2
  • $\begingroup$ Thank you for your help, my problem is solved. $\endgroup$
    – bubu
    Commented Mar 27 at 18:00
  • $\begingroup$ @bubu The usual way to say that is to either give an upvote or give the green check mark or both! :-) $\endgroup$
    – Peter K.
    Commented Mar 27 at 22:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.