Main Content

非均匀采样信号的光谱分析

This example shows how to perform spectral analysis on nonuniformly sampled signals. It helps you determine if a signal is uniformly sampled or not, and if not, it shows how to compute its spectrum or its power spectral density.

该示例介绍了LOMB-SCAPLGLE期间,可以计算非均匀采样信号的光谱。

不均匀的采样信号

非均匀的采样信号通常在汽车行业,通信中找到,以及作为医学和天文学的多样化。不均匀的采样可能是由于传感器不完全,不匹配的时钟或事件触发现象。

The computation and study of spectral content is an important part of signal analysis. Conventional spectral analysis techniques like the periodogram and the Welch method require the input signal to be uniformly sampled. When the sampling is nonuniform, one can resample or interpolate the signal onto a uniform sample grid. This, however, can add undesired artifacts to the spectrum and might lead to analysis errors.

A better alternative is to use the Lomb-Scargle method, which works directly with the nonuniform samples and thus makes it unnecessary to resample or interpolate. The algorithm has been implemented in thepl功能。

缺失数据信号的光谱分析

考虑一种温度监控系统,其中微控制器记录房间的温度并每15分钟将此读数传输到存储它的基于云的服务器。众所周知,互联网连接中的故障阻止基于云的系统接收微控制器发送的一些读数。此外,在测量时段期间至少一次微控制器的电池耗尽,导致采样中的差距很大。

加载温度读数和相应的时间戳。

加载('nonuniformdata.mat''roomtemp''t1')图绘图(T1 /(60 * 60 * 24 * 7),RoomTemp,'行宽',1.2)网格xlabel('时间(周)'的)ylabel('温度(\ civff)'的)

图包含一个轴。包含一个obje轴ct of type line.

确定信号是否均匀采样的简单方法是在连续采样时间之间采用间隔的直方图。

在几分钟内绘制采样间隔的直方图(时间差异)。仅包括样本存在的点。

tatpoints = t1(〜isnan(室用品))/ 60;timeintervaldiff = diff(tatpoints);DIST(TimeIntervalDiff,0:100)网格XLabel('Sampling intervals (minutes)'的)ylabel('出现'的)xlim([10 100])

图包含一个轴。包含一个obje轴ct of type patch. This object represents TimeIntervalDiff.

大多数测量值如预期的那样,相隔15分钟。然而,相当数量的出现具有大约30和45分钟的采样间隔,其对应于一个或两个连续丢弃的样本。这导致信号不均匀地采样。此外,直方图显示了一些围绕杆的抖动,显示出高次数。这与TCP / IP延迟有关。

Use the Lomb-Scargle method to compute and visualize the spectral content of the signal. To help visualize the spectrum better, consider frequencies up to 0.02 mHz, which correspond to about 13 cycles per week.

[Plomb,flomb] = plomb(roomtemp,t1,2e-5,'力量');图绘图(Flomb * 60 * 60 * 24 * 7,Plomb)网格Xlabel('频率(周期/周)'的)ylabel('力量(dbw)'的)

图包含一个轴。包含一个obje轴ct of type line.

The spectrum shows dominant periodicities at 7 cycles per week and 1 cycle per week. This is understandable, given that the data comes from a temperature-controlled building on a seven-day calendar. The spectral line showing a peak at 1 cycle per week indicates that the temperature in the building follows a weekly cycle, with lower temperatures on weekends and higher temperatures during the week. The spectral line of 7 cycles per week indicates that there is also a daily cycle with lower temperatures at night and higher temperatures during the day.

光谱分析of Signals with Unevenly Spaced Samples

心率变异性(HRV)信号,它代表心跳之间的时间的生理变化,通常不均匀地采样,因为人的心率不是恒定的。HRV信号源自心电图(ECG)读数。

HRV信号的采样点位于心电图的R高峰时段。每个点的幅度被计算为连续R峰峰之间的时间差的逆,并且被放置在第二R峰的瞬间。

%加载信号,时间戳和采样率加载('nonuniformdata.mat''ECGSIG''t2''Fs'的)% Find the ECG peaks[pks,locs] = findpeaks(ecgsig,Fs,......'minpeakprominence'那0.3,'minpeakheight',0.2);%确定RR间隔rlocsinterval = diff(locs);% Derive the HRV signaltHRV = locs(2:end); HRV = 1./RLocsInterval;%绘制信号图A1 =子图(2,1,1);绘图(T2,ECGSIG,'B'那locs,pks,'* r')网格A2 =子图(2,1,2);绘图(THRV,HRV)网格XLABEL(A2,'Time(s)')Ylabel(A1,'心电图(MV)')Ylabel(A2,'HRV (Hz)'的)

Figure contains 2 axes. Axes 1 contains 2 objects of type line. Axes 2 contains an object of type line.

R峰之间的变化间隔导致HRV数据中的样品时间不均匀性。考虑信号的峰值位置,并在几秒钟内绘制它们的分离的直方图。

figure hist(RLocsInterval) grid xlabel('抽样间隔(s)'的)ylabel('RR distribution'的)

图包含一个轴。包含一个obje轴ct of type patch. This object represents RLocsInterval.

HRV光谱中兴趣的典型频段是:

  • Very Low Frequency (VLF), from 3.3 to 40 mHz,

  • 低频(LF),40至150 MHz,

  • High Frequency (HF), from 150 to 400 mHz.

These bands approximately confine the frequency ranges of the distinct biological regulatory mechanisms that contribute to HRV. Fluctuations in any of these bands have biological significance.

Useplto calculate the spectrum of the HRV signal.

figure plomb(HRV,tHRV,'Pd',[0.95,0.5])

Figure contains 2 axes. Axes 1 is empty. Axes 2 with title Lomb-Scargle Power Spectral Density Estimate contains 3 objects of type line.

The dashed lines denote 95% and 50% detection probabilities. These thresholds measure the statistical significance of peaks. The spectrum shows peaks in all three bands of interest listed above. However, only the peak located at 23.2 mHz in the VLF range shows a detection probability 95%, while the other peaks have detection probabilities of less than 50%. The peaks lying below 40 mHz are thought to be due to long-term regulatory mechanisms, such as the thermoregulatory system and hormonal factors.

也可以看看