# 非均匀采样信号的频谱分析

### 缺失数据的信号的频谱分析

```load('nonuniformdata.mat','roomtemp','t1') figure plot(t1/(60*60*24*7),roomtemp,'LineWidth',1.2) grid xlabel('Time (weeks)') ylabel('Temperature (\circF)')```

```tAtPoints = t1(~isnan(roomtemp))/60; TimeIntervalDiff = diff(tAtPoints); figure hist(TimeIntervalDiff,0:100) grid xlabel('Sampling intervals (minutes)') ylabel('Occurrences') xlim([10 100])```

```[Plomb,flomb] = plomb(roomtemp,t1,2e-5,'power'); figure plot(flomb*60*60*24*7,Plomb) grid xlabel('Frequency (cycles/week)') ylabel('Power (dBW)')```

### 非等间距采样信号的频谱分析

HRV 信号的采样点位于 ECG 的 R 峰值时间。每个点的振幅计算为连续 R 峰值之间时间差的倒数，并放在第二个 R 峰值的瞬时位置。

```% Load the signal, the timestamps, and the sample rate load('nonuniformdata.mat','ecgsig','t2','Fs') % Find the ECG peaks [pks,locs] = findpeaks(ecgsig,Fs, ... 'MinPeakProminence',0.3,'MinPeakHeight',0.2); % Determine the RR intervals RLocsInterval = diff(locs); % Derive the HRV signal tHRV = locs(2:end); HRV = 1./RLocsInterval; % Plot the signals figure a1 = subplot(2,1,1); plot(t2,ecgsig,'b',locs,pks,'*r') grid a2 = subplot(2,1,2); plot(tHRV,HRV) grid xlabel(a2,'Time(s)') ylabel(a1,'ECG (mV)') ylabel(a2,'HRV (Hz)')```

R 峰值之间的变化间隔导致 HRV 数据中的采样时间非均匀性。考虑信号的峰值位置，并以秒为单位绘制其间隔直方图。

```figure hist(RLocsInterval) grid xlabel('Sampling interval (s)') ylabel('RR distribution')```

HRV 频谱中感兴趣的典型频带是：

• 超低频 (VLF)，从 3.3 到 40 mHz，

• 低频 (LF)，从 40 到 150 mHz，

• 高频 (HF)，从 150 到 400 mHz。

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