《DSP using MATLAB》樣本Example5.23

來源:互聯網
上載者:User

標籤:pre   set   log   bsp   alt   plot   max   end   .com   

代碼:

conv_time = zeros(1,150); fft_time = zeros(1, 150);%% Nmax = 2048; for L = 1:150tc = 0; tf = 0;N = 2*L-1; nu = ceil(log10(N)/log10(2)); N = 2^nu;for I = 1:100h = 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;endn=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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.