MATLAB 穿级计数分析

穿级计数法原理

穿级计数法是幅值域分析的常用方法,为单参数计数法,将整个载荷幅值范围分成等间距的若干级;通过统计信号采样点上升或下降时穿过某一级的次数,反映信号在各载荷水平的分布情况,如图所示。

MATLAB 代码

lcf.m
function [ lcf, thr ] = lcr( sig, thr );
% LCR calculates Level Crossing Rate, that is a number
%   of crossings (in the positive direction) of an input 
%   vector through a given threshold vector.
%       [ x, t ] = lcr( sig, thr );
%
%   The crossings are calculated for all the values of the input threshold vector. The input signal has to be a vector.

% COMMENTS:
% The algorithm usues the Matlab matrix function instead of algorithm mased on definition of LCR. 
% This algorithm is about 30 times faster than traditional (Matlab implementation).

    % check errors:
    if( (nargin~=2) | (ndims(sig)~=2) )
        error( 'Wrong input parameters!' );
    end
    % calculate lcf for each threshold:
    for i = 1:length( thr ),
        tmp = ( sig > thr(i) );
        tmp = diff( tmp );
        lcf( i ) = sum( tmp==1 );
    end
return;    

例子

clear;clc;close all;
load Fs; % 输入数据

t = Fs(:,1); x = Fs(:,2);

% 增大幅值--针对存在负值的数据
s = min(x);s = abs(s);
x = x+s;

m = 50; % 载荷幅值的等分间距
 
y0=lcr(x,min(x):m:max(x));

figure(1)
t0=1:length(y0);
t0=t0*m;
plot(t0-s,y0,'k'); % 将图像平移回正确位置

穿级计数结果

代码参考Level Crossing Rate - File Exchange - MATLAB Central (mathworks.cn)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值