556
Practical MATLAB
® Applications for Engineers
fprintf(‘cpu.time =
%6.6f\n’,t1);
fprintf(‘time elapse =%6.6f\n’,tictoca);
disp(‘************************************************************’)
% Script file: time _ analysis _ 513
% statistic analysis using 513 points
clear;
tstarta = clock; tic;
taa = cputime;
fs = 8000;Ts=1/fs; N= 513;
t = linspace(0,Ts*512,513); signal _ 513 = cos(2*pi*850.*t);
DFT _ 613 = fft(signal _ 513,513);
estimeaa = etime(clock,tstarta);
tictocaa = toc;
t1a = cputime-taa;
disp (‘**************
T I M E
S T A T I S T I C S *********’)
disp (‘
f(n) consist of 513 samples
‘)
fprintf (‘est.time =
%6.6f\n’,estimeaa);
fprintf (‘cpu.time =
%6.6f\n’,t1a);
fprintf (‘time elapse =%6.6f\n’,tictocaa);
disp (‘****************************************************************’)
>> time _ analysis _ 512
******************R E S U L T S ************************
**********
T I M E
S T A T I S T I C S *******
f(n) consist of 512 samples
est.time =
0.010000
cpu.time =
0.020000
time elapse =0.020000
*********************************************************
>> time _ analysis _ 513
**********
T I M E
S T A T I S T I C S
******
f(n) consist of 513 samples
est.time =
0.020000
cpu.time =
0.030000
time elapse =0.030000
*********************************************************
Observe from the preceding results that the time effi ciency increases when using 512
samples (power of 2) instead of 513 samples, when evaluating (executing) the fft of the
(arbitrary) function f(t) = cos(2π850t).
5.5 Application Problems
P.5.1 Determine if the following systems are LTI:
a. g(n) = f(n) . f(n)
b. g(n) = log[f(n)]
c. g(n) = cos[f(n)]
CRC_47760_CH005.indd 556
CRC_47760_CH005.indd 556
7/23/2008 1:47:43 PM
7/23/2008 1:47:43 PM
Précédent

- 567/708

Suivant