《DSP using MATLAB》示例Example5.23
代码:
conv_time = zeros(1,150); fft_time = zeros(1, 150);
%
% Nmax = 2048;
for L = 1:150
tc = 0; tf = 0;
N = 2*L-1; nu = ceil(log10(N)/log10(2)); N = 2^nu;
for I = 1:100
h = randn(1,L); x = rand(1,L);
t0 = clock; y1 = conv(h,x); t1 = etime(clock,t0); tc = tc + t1;
t0 = clock; y2 = ifft(fft(h,N) .* fft(x,N)); t2 = etime(clock,t0);
tf = tf + t2;
end
%
conv_time(L)=tc/100; fft_time(L)=tf/100;
end n=1:150; figure('NumberTitle', 'off', 'Name', 'Exameple5.23 ')
set(gcf,'Color','white');
plot(n(25:150), conv_time(25:150), n(25:150), fft_time(25:150));
xlabel('sequence length N'); ylabel('Time in Sec.'); title('comparison of convolution times');
运行结果:
我的机子结果如下图:
书中的例子,运行结果如下图:
《DSP using MATLAB》示例Example5.23的更多相关文章
- DSP using MATLAB 示例Example3.23
代码: % Discrete-time Signal x1(n) : Ts = 0.0002 Ts = 0.0002; n = -25:1:25; nTs = n*Ts; x1 = exp(-1000 ...
- 《DSP using MATLAB》Problem5.23
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% O ...
- DSP using MATLAB 示例Example3.21
代码: % Discrete-time Signal x1(n) % Ts = 0.0002; n = -25:1:25; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*a ...
- DSP using MATLAB 示例 Example3.19
代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Discrete-time Signa ...
- DSP using MATLAB示例Example3.18
代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Continuous-time Fou ...
- DSP using MATLAB 示例Example3.22
代码: % Discrete-time Signal x2(n) Ts = 0.001; n = -5:1:5; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*abs(nT ...
- DSP using MATLAB 示例Example3.17
- DSP using MATLAB示例Example3.16
代码: b = [0.0181, 0.0543, 0.0543, 0.0181]; % filter coefficient array b a = [1.0000, -1.7600, 1.1829, ...
- DSP using MATLAB 示例 Example3.15
上代码: subplot(1,1,1); b = 1; a = [1, -0.8]; n = [0:100]; x = cos(0.05*pi*n); y = filter(b,a,x); figur ...
随机推荐
- Android ExpandableGridView的实现
近期在做项目的时候碰到了这样一个布局 在android中有种实现折叠list方式是ExpandableListView 但是官方没有ExpandableGridView 那么怎么样用Expandab ...
- 【bzoj1606】[Usaco2008 Dec]Hay For Sale 购买干草
题目描述 约翰遭受了重大的损失:蟑螂吃掉了他所有的干草,留下一群饥饿的牛.他乘着容量为C(1≤C≤50000)个单位的马车,去顿因家买一些干草. 顿因有H(1≤H≤5000)包干草,每一包都有它的体 ...
- SecureCRT中设置 \n 为回车换行,和 \r\n 的行为一致
勾上途中红框的选项即可
- oracle 视图的创建,游标,left join
视图的创建: create or replace view dmv_mat_contract_stock_in_bill as select csib.*, sib.STOCK_IO_, sib.CO ...
- tab 切换写法
<script> var oUL = document.getElementById('aboutTab-ul'); var oLi = oUL.getElem ...
- 利用SQLite_Expert实现Excel表转SqLite数据库
1.保留excel数据中需要的字段,删除无关字段. 2.将excel另存为cvs格式文件.<另存名称如:jizhan.cvs 则导入后表名即为jizhan> 3.看下图,新建数据库,命名为 ...
- MySQL 日期、时间转换函数
MySQL 日期.时间转换函数:date_format(date,format), time_format(time,format) 能够把一个日期/时间转换成各种各样的字符串格式.它是 str_to ...
- selenium 3.0 beta2 初体验
经过漫长的等待,终于迎来了selenium 3.0 从selenium 1.0 至今,差不多有十多年的历史.这个月终于迎来了selenium3.0 那么selenium3.0 为我们带来了什么? 看一 ...
- 解除sql server数据库占用
use master go ) set @dbName='dbname' --数据库名 ) declare cur_lock cursor for SELECT DISTINCT request_se ...
- caffe_实战之两个简单的例子(物体分类和人脸检测)
一.物体分类: 这里使用的是caffe官网中自带的例子,我这里主要是对代码的解释~ 首先导入一些必要的库: import caffe import numpy as np import matplot ...