weixin_41826289 2018-03-12 06:48 采纳率: 0%
浏览 1010
已结题

计算HHT时频谱和边际谱出现错误

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
图片说明
图片说明

  • 写回答

1条回答 默认 最新

  • qq1450717037 2021-12-08 09:12
    关注

    请问最后解决了吗

    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?