ComplexDemodulation — Perform demodulation of a narrow band signal using complex demodulation
[IFreq,IAmp,Iphase,delay,f0] = ComplexDemodulation(signal,sigref [,LP])
a real vector of length N
: the narrow band signal to be analysed.
a real scalar: frequency reference (in normalized
frequency) or a real vector of length
N
: signal whose slowly varying
frequency give the frequency reference.
a real vector with odd length: the lowpass wfir filter coefficients Add here the
parameter description. The default value is computed by
LP=wfir("lp",195,[0.01 0],"hm",[0 0])
.
a real row vector of length N+delay
:
the instaneous frequency of the given signal (in
normalized frequency unit)
a real row vector of length N+delay
:
the instaneous amplitude of the given signal
a real row vector of length N+delay
:
the instaneous phase of the given signal
a positive integer, the time shift between the given signal and the instaneous frequency, amplitude and phase due to the low pass filtering.
The instantaneous frequency of the reference signal (in normalized frequency unit)
[IFreq,IAmp,Iphase,delay,f0] =
ComplexDemodulation(signal,sigref [,LP])
computes the
demodulation of a narrow band signal using complex demodulation.
The output signals are delayed by delay
points so that IFreq(k)
corresponds to
signal(k+delay)
.
// Create a frequency modulated signal f0=11;Tmax=10; freq_sampling=f0*55; fw=0.3; // time instants t=0:1/freq_sampling:Tmax;N=size(t,'*'); // Frequency modulation (linear) IFreq_ref=f0+linspace(-fw,fw,N); // Amplitude modulation n1=round(N/2); A=[linspace(1,3,n1) linspace(3,2,N-n1)];; //variable amplitude (triangle // Input signal sig=A.*cos(2*%pi*IFreq_ref.*t); //Call the complex demodulation [IFreq,IAmp,IPhase,delay,f0e]=ComplexDemodulation(sig,f0/freq_sampling); //Take sampling frequency into account IFreq=IFreq*freq_sampling; f0e=f0e*freq_sampling; //Draw results clf;f=gcf();f.figure_name="CDM"; ds=delay/freq_sampling; t1=(0:(N-1+delay))/freq_sampling; // Given signal subplot(311); plot(t+ds,sig,'b',t1,IAmp,'r'); a=gca();a.data_bounds(:,2)=[-3;4]; legend(["Signal","IAmp"],"in_upper_left"); a.grid(1:2)=color("gray"); ylabel("Signal & IAmp") // Instantaneous frequency subplot(312); dsig=diff(sig); k=find((dsig(1:$-1)>0)&(dsig(2:$).*dsig(1:$-1)<0)); p=t(k(2:$))-t(k(1:$-1)); IFe=1 ./p; plot(t1,IFreq,'b',t+ds,IFreq_ref,'r',t(k(1:$-1)+1),IFe,'g'); a=gca();a.data_bounds(:,2)=[10;13]; ylabel("IF (Hz)") a.grid(1:2)=color("gray"); legend(["CDM","Real","Estimated"],"in_upper_left"); // Instantaneous phase subplot(313);plot(t1,IPhase); a=gca(); ylabel("IPhase (rd)") a.grid(1:2)=color("gray");