这是一个关于hht变换很有用的工具箱

源代码在线查看: get.m

软件大小: 380 K
上传用户: jill
关键词: hht 变换 工具箱
下载地址: 免注册下载 普通下载 VIP

相关代码

				function val = get(c, prop, idx)
				% COMPONENTS/GET gets properties of a Components object
				%
				% Usage:
				%  val = get(c, prop [,idx])
				%
				% Parameters:
				%  c    - the Components object to query
				%  prop - the name of the desired property
				%  idx  - the index of the component to query (0 for the whole data)
				%
				% Valid properties are:
				%  'stime': start time
				%  'etime': end time
				%  'dt':    delta-t, or time increment per point
				%  'npts':  number of data points
				%  'nc':    number of components
				%  'data':  vector or matrix with raw data
				%
				% Hint: you can also access these properties like a MATLAB structure:
				%  nc = c.nc
				%  dt1 = c.dt(1)
				%  component2 = c.data(2);
				% etc.
				
				% Kenneth C. Arnold , 2004-07-30
				
				if nargin == 2; idx=[]; end
				if isempty(idx) idx=0; end
				
				if idx < 0 | idx > length(c.d)
				    error('components/get: index out of range');
				end
				
				switch prop
				    case 'stime'
				        if idx==0
				            val = c.stime;
				        else
				            val = c.d(idx).stime;
				        end
				    case 'etime'
				        if idx==0
				            val = c.etime;
				        else
				            val = c.d(idx).etime;
				        end
				    case 'dt'
				        if idx==0
				            val = (c.etime-c.stime)/(max(max(size([c.d.c])))-1);
				        else
				            val = (c.d(idx).etime-c.d(idx).stime)/(max(size(c.d(idx).c))-1);
				        end
				    case 'npts'
				        if idx==0
				            val = max(max(size([c.d.c])));
				        else
				            val = max(size(c.d(idx).c));
				        end
				    case 'nc'
				        val = length(c.d);
				    case 'data'
				        if idx==0
				            val = double(c);
				        else
				            val = c.d(idx).c;
				        end
				    otherwise
				        error([prop ' is not a valid Components property']);
				end
							

相关资源