function [im,tt,ff]=toimage(A,f,varargin)
DEFSPL=400;
error(nargchk(2,5,nargin));
switch nargin
case 2
t=1:size(A,2);
sply=DEFSPL;
splx=length(t);
case 3
if isscalar(varargin{1})
t=1:size(A,2);
splx=length(t);
sply=varargin{1};
else
t=varargin{1};
splx=length(t);
sply=DEFSPL;
end
case4
if isscalar(varargin{1})
t=1:size(A,2);
sply=varargin{1};
splx=varargin{2};
else
t=varargin{1};
sply=varargin{2};
splx=length(t);
end
case5
t=varargin{1};
splx=varargin{2};
sply=varargin{3};
end
if isvector(A)
A=A(:)';
f=f(:)';
end
if issparse(A)||~isreal(A)||length(size(A))>2
error('A argument must be a real matrix')
end
if issparse(f)||~isreal(f) || length(size(f))>2
error('f argument must be a real matrix')
end
if any(size(f)~=size(A))
error('A and f matrices must have the same size')
end
if issparse(t) || ~isreal(t) || ~isvector(t) || length(t)~=size(A,2)
error('t argument must be a vector and its length must be the number of columns in A and f inputs')
end
if~ isscalar(splx) || ~isreal(splx) ||splx~=floor(splx) ||splx<=0
error('splx argument must be a positive integer')
end
if~isscalar(sply) || ~isreal(sply) || sply ~=floor(sply) || sply<=0
error('splx argument must be a positive integer')
end
if any(diff(diff(t))) && splx~=length(t)
warning('toimage:nonuniformtimeinsants', 'when splx differs from length(t), the function only works for equally spaced time instants. You may consider reformating your data (using e.g. interpolation) before using toimage.')
end
f= min(f,0.5);
f=max(f,0);
indf= round(2*f*(sply-1)+1);
indt=repmat(round(linspace(1,length(t),splx)),size(A,1),1);
im= accumarray([indf(:),indt(:)],A(:),[sply,splx]);
indt=indt(1,:);
tt=t(indt);
ff=(0:sply-1)*0.5/sply+1/(4*sply);
end
计算HHT时频谱和边际谱出现错误
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答
悬赏问题
- ¥15 数学的三元一次方程求解
- ¥20 iqoo11 如何下载安装工程模式
- ¥15 本题的答案是不是有问题
- ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
- ¥15 C++使用Gunplot
- ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
- ¥15 matlab数字图像处理频率域滤波
- ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
- ¥15 ELGamal和paillier计算效率谁快?
- ¥15 蓝桥杯单片机第十三届第一场,整点继电器吸合,5s后断开出现了问题