plotMPSpectWithSlices

plotMPSpectWithSlices(stimes, sfreqs, spect_true, true_alpha, ss_mdl, ss_est, f_plot_resid, ofile_pref)

plotMPSpectWithSlices is a function to plot an observed spectrogram and its corresponding estimated spectrogram. It optionally plots the estimated residuals or forms an interactive subplot showing the spectra, observation estimate, and individual peak components at time slices. Estimated On-peaks (with true On-peaks, if available) can also be plotted.

Example call for one of the filter estimates in compareEKFs_jobs_wRandSSMs:

plotMPSpectWithSlices(stimes,sfreqs,sim_spect,alpha,s,est,2);

Example call from ex_real_data:

plotMPSpectWithSlices(stimes,sfreqs_trunc,nanpow2db(spect_trunc),[],ss,ss_est,2);

INPUTS:

stimes – 1 x NT vector of times. Required. sfreqs – 1 x NF vector of frequency bins. Required. spect_true – NF x NT spectrogram matrix. Required. true_alpha – num_combos x NT+1 matrix indicating true On/Off-peak

combinations. Optional, only possible for simulated data.

ss_mdl – StateSpaceMultiPeak object with parameters used to

obtain filter estimates in ss_est. The model is needed to recompute the filter observation estimate from the state estimates in the case when filter what estimated using a subsampling of frequency bins. Only required if estimated frequency bins differ from sfreqs, or if plotting the estimated On-peaks is desired.

ss_est – struct containing filter estimates. Required. f_plot_resid – integer flag indicating arrangement of output figures.

0 - Plots main figure with observed spectrogram in

first axis; estimated spectrogram in second axis; an interactive time slice of spectrum, estimate, and individual peak components in third axis; and, if ss_mdl.peak_combos is provided, estimated On-peaks in fourth axis. Does not plot estimated residuals.

1 - Plots estimated residuals as a separate figure. 2 - Plots the estimated residuals in the third axis of

the main figure in place of the interactive slice plot.

Default is 1.

ofile_pref – path and filename prefix for saving figures.

Figures not saved if empty. Default is empty ‘’.

OUTPUTS:

Figures generated. Figures saved if ofile_pref provided.

20200224 – (v3) changed to input model (peak_combos and names no

longer input separately) so that the observation estimate can be resampled at different frequency bins. Inputs and their order consequently were changed

20200131 – (v2) added true combos.

added option to plot residuals in place of slices.

Created by Patrick Stokes