作业帮 > 综合 > 作业

matlab信号处理 程序哪里出错?

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/11 13:44:02
matlab信号处理 程序哪里出错?
clear;
clc;
fs=500;
t=0:1/fs:1-1/fs;
TempSignal=20*exp(-t/0.03)+20*sin(100*pi*t+(pi/3))+12*sin(200*pi*t+(pi/2))+10*sin(300*pi*t+(pi/6))+6*sin(400*pi*t+(pi/8))+5*sin(500*pi*t+(pi/5));
%[s] = tfd(TempSignal,DecomNum);
tempSignal=TempSignal';
N=length(tempSignal);
%s=zeros(DecomNum,N);
% a=zeros();
TempSignal=hilbert(TempSignal);
[tfr,t,f]=tfrwv(TempSignal');
figure(5);
contour(t/500,500*f,tfr);
title('维格纳-威利分布');
xlabel('时间 t');
ylabel('频率 f');
? Undefined function or method 'tfrwv' for input arguments of type 'double'.
报错上说的是tfrwv函数未定义,也就是matlab自带函数库里面没有这个函数
这个函数应该是网上某个人编的工具箱里面的一个子函数
function [tfr,t,f] = tfrwv(x,t,N,trace);
%TFRWV\x09Wigner-Ville time-frequency distribution.
%\x09[TFR,T,F]=TFRWV(X,T,N,TRACE) computes the Wigner-Ville distribution
%\x09of a discrete-time signal X,
%\x09or the cross Wigner-Ville representation between two signals.
%
%\x09X :signal if auto-WV,or [X1,X2] if cross-WV.
%\x09T :time instant(s) (default :1:length(X)).
%\x09N :number of frequency bins (default :length(X)).
%\x09TRACE :if nonzero,the progression of the algorithm is shown
%\x09 (default :0).
%\x09TFR :time-frequency representation.When called without
%\x09 output arguments,TFRWV runs TFRQVIEW.
%\x09F :vector of normalized frequencies.
%
%\x09Example :
%\x09 sig=fmlin(128,0.1,0.4); tfrwv(sig);
%
%\x09See also all the time-frequency representations listed in
%\x09the file CONTENTS (TFR*)
%\x09F.Auger,May-August 1994,July 1995.
%\x09Copyright (c) 1996 by CNRS (France).
%
%\x09------------------- CONFIDENTIAL PROGRAM --------------------
%\x09This program can not be used without the authorization of its
%\x09author(s).For any comment or bug report,please send e-mail to
%\x09f.auger@ieee.org
if (nargin == 0),
error('At least one parameter required');
end;
[xrow,xcol] = size(x);
if (nargin == 1),
t=1:xrow; N=xrow ; trace=0;
elseif (nargin == 2),
N=xrow ; trace=0;
elseif (nargin == 3),
trace = 0;
end;
if (N2),
error('X must have one or two columns');
elseif (trow~=1),
error('T must only have one row');
elseif (2^nextpow2(N)~=N),
fprintf('For a faster computation,N should be a power of two\n');
end;
tfr= zeros (N,tcol);
if trace,disp('Wigner-Ville distribution'); end;
for icol=1:tcol,
ti= t(icol); taumax=min([ti-1,xrow-ti,round(N/2)-1]);
tau=-taumax:taumax; indices= rem(N+tau,N)+1;
tfr(indices,icol) = x(ti+tau,1) .* conj(x(ti-tau,xcol));
tau=round(N/2);
if (ti=tau+1),
tfr(tau+1,icol) = 0.5 * (x(ti+tau,1) * conj(x(ti-tau,xcol)) + ...
x(ti-tau,1) * conj(x(ti+tau,xcol))) ;
end;
if trace,disprog(icol,tcol,10); end;
end;
tfr= fft(tfr);
if (xcol==1),tfr=real(tfr); end ;
if (nargout==0),
tfrqview(tfr,x,t,'tfrwv');
elseif (nargout==3),
f=(0.5*(0:N-1)/N)';
end;
以上函数仅供参考