function tfrqview(tfr,sig,t,method,p1,p2,p3,p4,p5);
%TFRQVIEW Quick visualization of time-frequency representations.
% TFRQVIEW(TFR,SIG,T,METHOD,P1,P2,P3,P4,P5) allows a quick
% visualization of a time-frequency representation.
%
% TFR : time-frequency representation (MxN).
% SIG : signal in time. If unavailable, put sig=[] as input
% parameter. (default : []).
% T : time instants (default : 1:N).
% METHOD : name of chosen representation (default : 'TYPE1').
% See the TFR* files for authorized names.
% TYPE1 : the representation TFR goes in normalized
% frequency from -0.5 to 0.5 ;
% TYPE2 : the representation TFR goes in normalized
% frequency from 0 to 0.5.
% P1...P5 : optional parameters of the representation : run the
% file TFRPARAM(METHOD) to know the meaning of P1..P5
% for your method.
%
% When you use the 'save' option in the main menu, you save all your
% variables as well as two strings, TfrQView and TfrView, in a mat
% file. If you load this file and do eval(TfrQView), you will restart
% the display session under tfrqview ; if you do eval(TfrView), you
% will obtain the exact layout of the screen you had when clicking on
% the 'save' button.
%
% Example :
% sig=fmsin(128); tfr=tfrwv(sig);
% tfrqview(tfr,sig,1:128,'tfrwv');
%
% See also TFRVIEW, TFRSAVE, TFRPARAM.
% F. Auger, September 1994, July 1995
% O. Lemoine, Oct 1995, May-July 1996.
% F. Auger, May 1998.
% Copyright (c) 1996 by CNRS (France).
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
comp=computer; % so as to know the running computer
MatlabVersion=version; MatlabVersion=str2num(MatlabVersion(1));
% Tests on the input arguments
if nargin<1,
error('At least one parameter required'); % at least the tfr
end
[tfrrow,tfrcol]=size(tfr);
if nargin==1,
sig=[]; t=1:tfrcol; method='type1'; % empty signal
elseif nargin==2,
t=1:tfrcol; method='type1';
elseif nargin==3,
method='type1';
end
[trow,tcol] = size(t);
if (trow~=1),
error('T must only have one row'); % t must be a row vector
end;
if (tfrcol~=tcol),
error('T must have as much elements as tfr has columns');
end;
[Nsig,Ncol]=size(sig);
if Ncol>2,
error('SIG must have one or two columns');
end
% Computation of Nf2, the number of interresting points in frequency
method=upper(method);
if istfr2(method),
Nf2=tfrrow;
elseif istfr1(method),
Nf2=tfrrow/2;
else
error('Unknown representation. Use type1 or type2');
end;
% Computation of freq (vector of frequency samples)
if istfraff(method),
freq=eval(['p',num2str(nargin-4)]); % last input argument is freqs.
else
freq=(0.5*(0:Nf2-1)/Nf2);
end
% Initialization of the variables
if exist('options.mat'),
load options
colormap(SavedColorMap);
else
threshold=5.0; % visualization threshold
linlogtfr=0; % tfr visualization scale : 0 for linear 1 for logarithmic
linlogspec=1; % spectrum visualization scale
sigenveloppe=0; % signal enveloppe visualization
levelnumb=64; % number of levels in the contour plot
colmap=1; % colormap index
display=2; % display index
isgridsig=0; % grid on signal
isgridspec=0; % grid on spectrum
isgridtfr=0; % grid on tfr
issig=0; % display signal
isspec=0; % display spectrum
iscolorbar=0; % display colorbar
fs=1.0; % sampling frequency (Hz)
fmin=0.0; % smallest displayed frequency
fmax=0.5*fs; % highest displayed frequency
end;
% Test of analycity
if ~isempty(sig),
for k=1:Ncol,
% spec(:,k)=abs(fft(sig(min(t):max(t),k))).^2; Nsp=length(spec);
% modifications : F. Auger (fog), 30/11/97
Lt_fog=max(t)-min(t)+1;
Nb_tranches_fog = floor(Lt_fog/tfrrow);
% fprintf('%f \n',Nb_tranches_fog);
spec(:,k)=zeros(tfrrow,1);
for Num_tranche_fog=0:Nb_tranches_fog-1,
% fprintf('%f \n',Num_tranche_fog);
spec(:,k)=spec(:,k)+abs(fft(sig(min(t)+tfrrow*Num_tranche_fog+(0:tfrrow-1),k))).^2;
end;
if (Lt_fog>Nb_tranches_fog*tfrrow),
spectre_fog=fft(sig(min(t)+tfrrow*Nb_tranches_fog:max(t),k),tfrrow);
spectre_fog=spectre_fog(:);
spec(:,k)=spec(:,k)+abs(spectre_fog).^2;
end;
% spec1=sum(spec(1:tfrrow/2,k));
% spec2=sum(spec(tfrrow/2+1:Nsp,k));
spec1=sum(spec(1:tfrrow/2,k));
spec2=sum(spec(tfrrow/2+1:tfrrow,k));
if spec2>spec1/10,
disp('Be careful : the signal is not analytic!');
end
end
end
% Test of reality
if (Ncol==2 & ~isreal(tfr)),
disp('Cross distribution. As the result is complex, we display the real part.');
tfr=real(tfr);
end
ChoiceDisplay = 1; % All the possible values of the choice variable
ChoiceLayout = 2;
ChoiceSampling = 3;
ChoiceFreqBounds = 4;
ChoiceThreshold = 5;
ChoiceLinlog = 6;
ChoiceRedraw = 7;
ChoiceNewFigure = 8;
ChoiceSaveResults = 9;
ChoiceSaveOptions = 10;
ChoicePrint = 11;
ChoiceClose = 12;
CallTfrView = 1; % 1 to call tfrview, 0 not to do it
RefreshFigure=1; % 1 to refresh figure every time, 0 to freeze
choice=ChoiceSampling;
while choice~=ChoiceClose, % while not close
if RefreshFigure & CallTfrView, % Call to tfrview
linlog=linlogtfr+2*linlogspec+4*sigenveloppe;
isgrid=isgridsig+2*isgridspec+4*isgridtfr;
layout=issig+isspec*2+iscolorbar*4+1;
param = [display, linlog, threshold, levelnumb, Nf2, layout,...
fs, isgrid, fmin, fmax];
if (nargin<=4),
tfrview(tfr,sig,t,method,param);
elseif (nargin==5),
tfrview(tfr,sig,t,method,param,p1);
elseif (nargin==6),
tfrview(tfr,sig,t,method,param,p1,p2);
elseif (nargin==7),
tfrview(tfr,sig,t,method,param,p1,p2,p3);
elseif (nargin==8),
tfrview(tfr,sig,t,method,param,p1,p2,p3,p4);
elseif (nargin==9),
tfrview(tfr,sig,t,method,param,p1,p2,p3,p4,p5);
end;
end;
if (linlogtfr==0), % Lin/log scale of the tfr
linlogstr='Change to a logarithmic scale';
else
linlogstr='Change to a linear scale';
end;
if (RefreshFigure==1),
redrawstr='Don''t redraw yet';
else
redrawstr='Redraw now';
end;
% Main menu
choice=menu ('TFRQVIEW MENU :',...
'Change the display mode',... % ChoiceDisplay
'Change the display layout',... % ChoiceLayout
'Change the sampling frequency',... % ChoiceSampling
'Change the frequency bounds',... % ChoiceFreqBounds
'Change the threshold',... % ChoiceThreshold
linlogstr,... % ChoiceLinlog
redrawstr,... % ChoiceRedraw
'New figure',... % ChoiceNewFigure
'Save results',... % ChoiceSaveResults
'Save options',... % ChoiceSaveOptions
'Print',... % ChoicePrint
'Close'); % ChoiceClose
if (choice==ChoiceDisplay), % Change the display mode
OldDisplay=display;
display=menu('DISPLAY MODE :',...
'contour',... % 1
'imagesc',...
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
西南交通大学研究生一年级现代信号处理作业 (146个子文件)
Entries 5KB
tfrqview.m 21KB
tfrview.m 20KB
tfrview2.m 19KB
tfrqview2.m 18KB
tfrspaw.m 8KB
tfrspbk.m 8KB
Contents.m 8KB
tfrunter.m 7KB
tfrbert.m 7KB
tfrdfla.m 7KB
tfrscalo.m 6KB
atoms.m 6KB
tfrrspwv.m 6KB
tfrrmsc.m 5KB
tfrrstan.m 5KB
ambifuwb.m 5KB
tftb_window.m 5KB
tfrrgab.m 5KB
tfrrpwv.m 5KB
tfrgrd.m 5KB
scale.m 5KB
tfrrsp.m 5KB
tfrcw.m 5KB
tfrridbn.m 5KB
tfrgabor.m 5KB
tfrbud.m 5KB
tfrridt.m 4KB
tfrridb.m 4KB
tfrrppag.m 4KB
tfrridh.m 4KB
tfrrpmh.m 4KB
tfrspwv.m 4KB
fmt.m 4KB
tfrbj.m 4KB
tfrsave.m 4KB
tfrscalt.m 4KB
tfrzam.m 4KB
tfrmhs.m 4KB
ridges.m 4KB
momttfr.m 4KB
contwtgn.m 4KB
tfrparam.m 4KB
instfreq.m 3KB
holder.m 3KB
tfrpmh.m 3KB
htl.m 3KB
tfrpwv.m 3KB
tffilter.m 3KB
ifestar2.m 3KB
fmsin.m 3KB
tfrmmce.m 3KB
plotsid.m 3KB
tfrsp.m 3KB
parafrep.m 3KB
fmpar.m 3KB
tfrppage.m 3KB
tfrstft.m 3KB
plotifl.m 3KB
midpoint.m 3KB
fmpower.m 3KB
tfrideal.m 3KB
tfristft.m 3KB
ambifunb.m 3KB
fmhyp.m 3KB
friedman.m 3KB
tfrri.m 3KB
tfrwv.m 3KB
tfrwv.m 3KB
noisecg.m 3KB
contwtgnmir.m 3KB
doppler.m 3KB
tfrmh.m 3KB
tfrpage.m 3KB
movpwjph.m 3KB
ifmt.m 2KB
movpwdph.m 2KB
dopnoise.m 2KB
altes.m 2KB
movsp2wv.m 2KB
movsc2wv.m 2KB
tfrsurf.m 2KB
imextrac.m 2KB
renyi.m 2KB
sgrpdlay.m 2KB
gaussn.m 2KB
gdpower.m 2KB
correlmx.m 2KB
anaqpsk.m 2KB
tftb.m 2KB
movcw4at.m 2KB
anafsk.m 2KB
anabpsk.m 2KB
fmlin.m 2KB
fmlin.m 2KB
momftfr.m 2KB
anaask.m 2KB
integ2d.m 2KB
fmconst.m 2KB
anasing.m 2KB
共 146 条
- 1
- 2
资源评论
nutriu
- 粉丝: 30
- 资源: 19
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功