⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flimit.m

📁 A MATLAB tool for analysis of Transient Otoacoustic Emission signals
💻 M
字号:
function lim = flimit(S, Sn, f, method, p)

%	lim = flimit(S, Sn, f, method, p)
%
%	flimit	finds the upper frequency limit of the spectrum 
%                
%
%   in:	S	signal spectrum
%	Sn	noise spectrum
%	f	frequency scale (default 0:(nf-1)/25000)
%	method	computation method
%		 'limit' as compared to spectrum maximum value (default)
%		 'mean'  mean spectral frequency
%	p	method dependent parameter
%		 'limit' limit (default 0.1)
%		 'mean'  0 = signal only, 1 = signal - noise
%
%  out:	lim	frequency limit

% (c) Heimo Ihalainen, Esa Ojala, Jukka Siuko 12.11.1990

[n1, nf] = size(S);
if nargin<3; fs = 25000; f = (0:nf-1)/(nf-1)/2*fs; end
if nargin<4; method = 'l'; end; method = method(1);
if nargin<5;
  if method=='l'; p = 0.1; elseif method=='m'; p = 0; end
end
if method=='l'
%  lim = f(max(find(S>p*max(S) & S>Sn )));
   Ind = find(dbs(S)>-18 & S>Sn);
%  Ind= find(f(Ind)<6500);
   lind = length(Ind); Inds = sort(Ind);
   if lind-2<=0; lim=1;end
   if lind-2>=0; lim = f(Inds(lind-1));end 
elseif method=='m'
% if p==0; lim = sum(f.*S)/sum(S);
  if p==0; Sa = (dbs(S) + 20).*(dbs(S)>-18);
  if sum(Sa)==0; lim=1;end 
  if sum(Sa)>0; lim = sum(f.*Sa)/sum(Sa);end
  elseif p==1; Sa = (S - Sn).*(S>Sn); lim = sum(f.*Sa)/sum(Sa);
  else error('Unknown parameter!');
  end
else error('Unknown method!');
end
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -