《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 ...
随机推荐
- python --> 正则表达式
在python中使用正则表达式,需要导入 re 模块 一. 元字符,包括 [] {} | ? * + . ^ $ \ () . 号:通配符,一个点号就代表一个字符,一般情况下不能通配换行符 \ ...
- 【codeforces 415D】Mashmokh and ACM(普通dp)
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...
- FTP下载文件失败
这几天的定时任务下载文件的脚本失败了. 于是手工执行测试,发现报550 Permission denied. Passive mode refused. 意思就是被动模式下,没有权限获取文件. 解决方 ...
- 通过openswan基于Azure平台搭建VPN server
用过Azure的读者都知道,Vnet一直是Azure比较自豪的地方,尤其是VPN,Azure提供了两种VPN以及专线来保证客户数据的安全性,S2S vpn(站点到站点的,基于IPsec的),P2S v ...
- 学习 opencv---(5) 创建Trackbar(活动条) &图像对比度,亮度值调整
学习如何在opencv 中用trackbar 函数创建和使用 轨迹条,以及图像对比度,亮度值的动态调整 一.OpenCV中轨迹条(Trackbar)的创建和使用 [1]创建轨迹条-----create ...
- SQL分组多列统计(GROUP BY后按条件分列统计)
as tjsl from fyxx group by zt,whbmbh end) as ybhsl from fyxx group by whbmbh 下面是摘自别人的博客 最近遇到一个问题,需要对 ...
- Best way to add Gradle support to IntelliJ Project
1, Touch build.gradle in root project folder, and use plugins: apply plugin: 'idea' apply plugin: 'j ...
- linux下vmware的安装、物理分区使用及卸载
1.安装 先下载安装文件VMware-Workstation-Full-12 在命令行下执行下载的文件安装即可(需要root权限) wget https://download3.vmware.com/ ...
- js 实现图片实时预览
<body> 上传图片: <input type="file" name="file" style="width: 200px; h ...
- 【linux】scp命令
scp的作用是在不同主机之间传输文件. 用法: scp user@host:/path1 path2 说明: 把远程主机host中path1的内容拷贝到当前主机的path2 user是远程主机登陆用户 ...