For Programmers: Free Programming Magazines  


Home > Archive > Matlab > November 2005 > help me with a TFTB problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author help me with a TFTB problem
Zhipeng.Gao

2005-11-29, 9:58 pm

Please help me~~~~~~~~~~~
This problem is about how to set correct frequency bins when using
'tfrsp.m' and 'tfrview.m' (functions in time-frequency tool
box--TFTB).

I tried to analysis a 3-component signal using Spectrogram(tfrsp.m).

clear
clc
%----------produce the signal----------%
fm=4e14; % the maximum frequency
fs=2.5*fm; Ts=1/fs; % sampling frequency
tm=0.3e-12; % the maximum time
N = round(tm/Ts); % sampling points
t=linspace(0,tm,N); % time duration

%----------------------------------------------%
b1=exp(-((t-0.5e-13)/0.1e-13).^2);
b2=exp(-((t-1.5e-13)/0.1e-13).^2);
b3=exp(-((t-2.5e-13)/0.1e-13).^2);

f1=exp(-i*2*pi*1e14*t); % modulation frequency 1
f2=exp(-i*2*pi*4e14*t); % modulation frequency 2
f3=exp(-i*2*pi*2.5e14*t); % modulation frequency 3
%%%%%%%%%%%%%%%%%
s=b1.*f1+b2.*f2+b3.*f3;
s=s'; % transpose
%-------------------------------------%
wl=N/4; % the length of analysis window
h=tftb_window(wl,'hamming'); % analysis window

tt=1:length(s); % time instants
M=length(s); % number of frequency bins
tfr = tfrsp(s,tt,M,h);

NF2 = M/2;
% NF2 is the number of frequency bins displayed
% question here question here question here

param=[1, 0, 0, 18, NF2, 4, fs, 1, 0, 0.5];
figure
tfrview(tfr,s,tt,'tfrsp',param);

The problem is why I had to set 'NF2=M/2' is I want to get a correct
display of the tfr(time-frequency representation).

Compared with the problem, when I use 'tfrwv.m', I can get the
correct dislay of tfr by using the following codes:
(....the same as the former case)
[tfr,t,f]=tfrwv(s,tt,M);
NF2=M;
param=[1, 0, 0, 18, NF2, 4, fs, 1, 0, 0.5];
figure
tfrview(tfr,s,tt,'tfrwv',param);

Please help me~~~~~~~~~~~
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com