资源简介
matlab程序,找出一维信号的波峰。还可以把小值变为极大值,在求出波谷。
更重要的是有大量的交互操作,满足对峰值的精确定位要求。
代码片段和文件信息
function idemo1
% Self-contained demonstration function for comparing the iPeak and
% Peakfit functions applied to a test signal consisting of four peaks.
% T. C. O‘Haver July 2012
increment=1;
x=[1:increment:500];
% For each simulated peak specify the amplitude position and width
% and the overall random noise level.
amp=[100 200 300 400]; % Amplitudes of the peaks (Change if desired)
pos=[100 200 300 400]; % Positions of the peaks (Change if desired)
wid=[50 50 50 50]; % Widths of the peaks (Change if desired)
Noise=2; % Amount of random noise added to the signal. (Change if desired)
% A = matrix containing one of the unit-amplidude peak in each of its rows
A = zeros(length(pos)length(x));
ActualPeaks=[0 0 0 0 0];
p=1;
for k=1:length(pos)
% Create a series of peaks of different x-positions
A(k:)=exp(-((x-pos(k))./(0.6005615.*wid(k))).^2); % Gaussian peaks
% alternatively A(k:)=ones(size(x))./(1+((x-pos(k))./(0.5.*wid(k))).^2); % Lorentzian peaks
% Assembles actual parameters into ActualPeaks matrix: each row = 1
% peak; columns are Peak # Position Height Width Area
ActualPeaks(p:) = [p pos(k) amp(k) wid(k) 1.0646.*amp(k).*wid(k)];
p=p+1;
end
z=amp*A; % Multiplies each row by the corresponding amplitude and adds them up
y=z+Noise.*randn(size(z)); % Optionally adds random noise
% y=y+gaussian(x04000); % Optionally adds a broad background signal
demodata=[x‘ y‘]; % Assembles x and y vectors into data matrix
% Compare MeasuredPeaks to ActualPeaks
disp(‘-----------------------------------------------------------------‘)
disp(‘Demonstration script for comparing the iPeak and Peakfit functions.‘)
disp(‘Detection and measurement of four peaks with heights 100 200 ‘)
disp(‘300 and 400. Data are contained in the 2 x n matrix demodata‘)
disp(‘ ‘)
disp([‘Random noise in signal = ‘ num2str(Noise)])
disp(‘ ‘)
disp(‘ Peak # Position Height Width Area‘)
ActualPeaks
disp(‘ ‘)
disp(‘Using iPeak:‘)
PeakD=6;
disp([‘>> MeasuredPeaks=ipeak(demodata‘ num2str(PeakD) ‘)‘])
disp(‘ ‘)
disp(‘iPeak finds all the peaks in a signal at once returning a‘)
disp(‘table of estimated peak positions heights widths and areas.‘)
disp(‘ ‘)
% Now call iPeak with specified value of the peak detection factor (PeakD).
% The numerical argument (PeakD) is an estimate of the ratio of the typical
% peak width to the length of the entire data record (PeakD). Small values
% detect fewer peaks; larger values detect more peaks.
tic;
MeasuredPeaks=ipeak(demodataPeakD);
iPeakTime=toc;
NumPeaks=max(MeasuredPeaks(:1));
disp([‘Number of peaks detected = ‘ num2str(NumPeaks)])
disp(‘ Peak # Position Height Width Area‘)
MeasuredPeaks
if size(ActualPeaks)==size(MeasuredPeaks)
AverageiPeakErrors=mean(abs(100.*(ActualPeaks-MeasuredPeaks)./ActualPeaks))
end
disp([‘Elapsed time is ‘ num2str(iPeakTime) ‘
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 15310 2013-07-21 16:40 findpeaks\idemos\hs_err_pid820.log
文件 89415 2012-07-31 07:07 findpeaks\idemos\idemo1.m
文件 91682 2012-07-30 06:25 findpeaks\idemos\idemo2.m
文件 107015 2013-07-21 16:18 findpeaks\idemos\ipf.m
文件 37350 2013-06-10 10:34 findpeaks\idemos.zip
文件 1397560 2013-06-10 10:12 findpeaks\PeakFind2.wmv
..A.SH. 5632 2013-06-25 22:17 findpeaks\Thumbs.db
目录 0 2013-07-24 01:24 findpeaks\idemos
目录 0 2013-06-25 22:17 findpeaks
----------- --------- ---------- ----- ----
1743964 9
- 上一篇:matlab端点检测vad程序
- 下一篇:捷联惯导的解算程序
相关资源
- matlab端点检测vad程序
- B样条图形绘制matlab
- matlab 地质应用 绘制三维地质图
- Matlab及其在测井中的应用.pdf
- surf算法-MATLAB源码
- 通信信号识别的经典matlab仿真
- MATLAB机器人坐标变换代码
- 神经网络matlab代码
- 计算射线穿过网格的一系列坐标matl
- wfg_matlab code
- 变步长的LMS自适应滤波算法matlab程序
- 曲线演化的Matlab源代码
- 常见的几种雷达信号的matlab仿真
- 基于MATLAB的2FSK数字通信系统设计
- 基于MATLAB的图像复原
- 基于MATLAB的图像灰度修正程序
- 改进的中值滤波MATLAB程序
- 光流法——matlab
- Matlab图像处理——小波变换去噪声、
- Matlab图像处理程序——去噪、边缘增
- 基于Matlab的数字信号处理仿真系统实
- 窗函数法设计FIR数字滤波器Matlab程序
- Matlab实现音频的分贝图
- EM算法完整matlab代码
- 小波融合代matlab源代码
- Gabor滤波特征提取方法 matlab程序
- matlab取目标轮廓坐标
- MATLAB课程设计数字拼图游戏.7z
- 基于BP神经网络的系统建模辨识与预测
- matlab程序之滤波器
评论
共有 条评论