• 大小: 4KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-06-02
  • 语言: Matlab
  • 标签: 平滑滤波  

资源简介

写MATLAB调用函数,可实现谱线的快速平滑滤波功能,提高谱线信噪比。

资源截图

代码片段和文件信息

function SmoothY=fastsmooth(Ywtypeends)
% fastsmooth(Ywtypeends) smooths vector Y with smooth 
%  of width w. Version 3.0 October 2016.
% The argument “type“ determines the smooth type:
%   If type=1 rectangular (sliding-average or boxcar) 
%   If type=2 triangular (2 passes of sliding-average)
%   If type=3 pseudo-Gaussian (3 passes of sliding-average)
%   If type=4 pseudo-Gaussian (4 passes of same sliding-average)
%   If type=5 multiple-width (4 passes of different sliding-average)
% The argument “ends“ controls how the “ends“ of the signal 
% (the first w/2 points and the last w/2 points) are handled.
%   If ends=0 the ends are zero.  (In this mode the elapsed 
%     time is independent of the smooth width). The fastest.
%   If ends=1 the ends are smoothed with progressively 
%     smaller smooths the closer to the end. (In this mode the  
%     elapsed time increases with increasing smooth widths).
% fastsmooth(Ywtype) smooths with ends=0.
% fastsmooth(Yw) smooths with type=1 and ends=0.
%
% Examples:
% fastsmooth([1 1 1 10 10 10 1 1 1 1]3)= [0 1 4 7 10 7 4 1 1 0]
%
% fastsmooth([1 1 1 10 10 10 1 1 1 1]311)= [1 1 4 7 10 7 4 1 1 1]
%
% x=1:100;
% y=randn(size(x)); 
% plot(xyxfastsmooth(y531)‘r‘)
% xlabel(‘Blue: white noise.    Red: smoothed white noise.‘)
%
% Demonstration scripts and functions: SmoothExperiment.m 
% SmoothWidthTest.m smoothdemo.m SmoothOptimization.m 
% DemoSegmentedSmooth.m DeltaTest.m SmoothVsCurvefit.m
%
% Related functions: SegmentedSmooth.m medianfilter.m killspikes.m  
% Download from 
% https://terpconnect.umd.edu/~toh/spectrum/functions.html

% Copyright (c) 20122018 Thomas C. O‘Haver

% Permission is hereby granted free of charge to any person obtaining a copy
% of this software and associated documentation files (the “Software“) to deal
% in the Software without restriction including without limitation the rights
% to use copy modify merge publish distribute sublicense and/or sell
% copies of the Software and to permit persons to

评论

共有 条评论