目录
1.算法描述
2.仿真效果预览
3.MATLAB核心程序
4.完整MATLAB
1.算法描述
峰值检验是示波表中数据采集方式之一, 这种技术起源于存储深度不能满足捕获毛刺的需要。如果用模拟示波器去观察, 只有当毛刺信号是重复性的并且和主信号同步时, 才能看到毛刺信号 。由于毛刺源于其他电路系统, 所以这些毛刺只是偶尔发生, 并且和主信号不同步。正常采样方式时, 要捕捉窄的毛刺, 示波表必须将收集到的全部采样数据存储到示波表中, 对于快速扫描, 单次触发就涉及到几千个数据, 而慢速的扫描则需要更大的存储器。峰值检测不像正常采样那样给出一个详细的完整波形显示, 而是以最高的采样率捕捉信号, 简单地忽略某些采样, 只记录发生在每个采样间隔期间内的最大最小的峰值, 这样就不用增加存储深度, 还可以捕捉毛刺或偶发事件。峰值检测是数字示波表的重要技术之一, 主要用来实现波形的毛刺捕捉, 包络的显示以及限制混叠。
2.仿真效果预览
matlab2022a仿真结果如下:
文章来源:https://www.toymoban.com/news/detail-521464.html
3.MATLAB核心程序
......................................................................
pos=[200:50:17800]; % Positions of the peaks (Change if desired)
amp=round(10.*randn(1,length(pos))); % Amplitudes of the peaks (Change if desired)
wid=20.*ones(size(pos)); % Widths of the peaks (Change if desired)
Noise=.1; % 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)
if amp(k)>9, % Keep only those peaks above a certain amplitude
% Create a series of peaks of different x-positions
A(k,:)=exp(-((x-pos(k))./(0.6005615.*wid(k))).^2); % Gaussian peaks
ActualPeaks(p,:) = [p pos(k) amp(k) wid(k) 1.0646.*amp(k)*wid(k)];
p=p+1;
end;
end
z=amp*A; % Multiplies each row by the corresponding amplitude and adds them up
y=z+Noise.*randn(size(z)); % Adds constant random noise
figure(1);plot(x,y,'r') % Graph the signal in red
% Initial values of variable parameters
WidthPoints=mean(wid)/increment; % Average number of points in half-width of peaks
SlopeThreshold=0.5*WidthPoints^-2; % Formula for estimating value of SlopeThreshold
AmpThreshold=0.05*max(y);
SmoothWidth=round(WidthPoints); % SmoothWidth should be roughly equal the peak width (in points)
FitWidth=round(WidthPoints); % FitWidth should be roughly equal to the peak widths (in points)
% Lavel the x-axis with the parameter values
xlabel(['SlopeThresh. = ' num2str(SlopeThreshold) ' AmpThresh. = ' num2str(AmpThreshold) ' SmoothWidth = ' num2str(SmoothWidth) ' FitWidth = ' num2str(FitWidth) ])
end
A221
4.完整MATLAB
V文章来源地址https://www.toymoban.com/news/detail-521464.html
到了这里,关于基于matlab的高精度信号峰值检测算法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!