Computes the time moments of a signal by smoothed pseudo Wigner-Ville distribution.
[T,IFreq,IAmp,IPow,IDisp,delay] = TimeMoments(signal,options)
A real vector of size N
. the signal values
A struct with possible fields:
lowpass
: an odd length vector of
real numbers. The coefficients of an fir lowpass
filter. The default value is computed by
wfir("lp",195,[0.01 0],"hm",[0,0])
timewindowlength
: a real scalar
with positive integer odd value. The time smoothing window
length used in the smoothed pseudo Wigner-Ville
distribution. The default value is 77.
frequencywindowlength
: a real
scalar with positive integer odd value. The
frequency smoothing window length used in the smoothed pseudo
Wigner-Ville distribution. The default value is 75.
frequencybins
a real
scalar with positive integer power of 2 value. The number of frequency bins used in the smoothed pseudo
Wigner-Ville distribution. The default value is 128.
a real vector of size N+delay
. The signal time instants.
a real vectorof size N+delay
. The signal first moment in time (instantaneous frequency)
a real vectorof size N+delay
. The signal instantaneous amplitude.
a real vector of size N+delay
. The
signal time marginal (instantaneous power).
a real vector of size N+delay
. The
signal second moment in time (instantaneous dispersion).
a real scalar with integer value. The delay (in sample) between the given signal and
the IFreq
, Iamp
,
Idisp
, Ipow
signals.
TimeMoments
Computes the time moments of a
signal byusing smoothed pseudo Wigner-Ville distribution. The
input signal is extended by delay
points
equal to the final value.
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); [t1,IFreq,IAmp,IPow,IDisp,delay] = TimeMoments(sig); //Take sampling frequency into account IFreq=IFreq*freq_sampling; //Draw results clf;f.figure_name="SPWVD"; ds=delay/freq_sampling; t1=(t1-1)/freq_sampling; // Given signal subplot(211); plot(t+ds,sig,"m",t1,IAmp,"b"); a=gca(); a.grid(1:2)=color("gray"); ylabel("Signal&IAmp") legend(["signal","Amplitude"],"in_lower_left"); // Instantaneous frequency subplot(212); 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(["SPWVD","Real","Estimated"],"in_upper_left"); | ![]() | ![]() |