find interference using persistence spectrum -凯发k8网页登录
visualize an interference narrowband signal embedded in a broadband signal.
generate a chirp sampled at 1 khz for 500 seconds. the frequency of the chirp increases from 180 hz to 220 hz during the measurement.
fs = 1000; t = (0:1/fs:500)'; x = chirp(t,180,t(end),220) 0.15*randn(size(t));
the signal also contains a 210 hz sinusoid. the sinusoid has an amplitude of 0.05 and is present only for 1/6 of the total signal duration.
idx = floor(length(x)/6); x(1:idx) = x(1:idx) 0.05*cos(2*pi*t(1:idx)*210);
save the signal as a matlab® timetable.
s = timetable(seconds(t),x);
open signal analyzer and drag the timetable from the workspace browser to a display. click the time-frequency button to add a spectrogram view. on the spectrogram tab, under time resolution, select specify and enter a time resolution of 1 second. set the frequency limits to 100 hz and 290 hz. both signal components are visible.
go back to the display tab. click the time button to remove the time view and click the spectrum button to add a power spectrum view. the frequency range continues to be from 100 hz to 290 hz. the weak sinusoid is obscured by the chirp.
click the arrow under the spectrum button to change the spectrum
view to a persistence spectrum
view. on the persistence spectrum tab, under time resolution, select specify and enter a time resolution of 1 second. specify zero overlap between adjoining segments. set the power limits to –50 db and 0 db and the density limits to 0.1 and 4. now both signal components are clearly visible.
on the display tab, under share, click generate script and select persistence spectrum script
. the script appears in the matlab editor.
% compute persistence spectrum % generated by matlab(r) 9.7 and signal processing toolbox 8.2. % generated on: 26-dec-2018 16:07:45 % parameters timelimits = seconds([0 500]); % seconds frequencylimits = [100 290]; % hz timeresolution = 1; % seconds overlappercent = 0; %% % index into signal time region of interest s_x_roi = s(:,'x'); s_x_roi = s_x_roi(timerange(timelimits(1),timelimits(2),'closed'),1); % compute spectral estimate % run the function call below without output arguments to plot the results [p,f,pwr] = pspectrum(s_x_roi, ... 'persistence', ... 'frequencylimits',frequencylimits, ... 'timeresolution',timeresolution, ... 'overlappercent',overlappercent);
see also
apps
functions
- |