I am reading Proakis Digital signal processing using Matlab, 3rd edition I am performing example 5.23 but i am not getting same plot/results as book although i am using almost same code
First i am attaching my code and output and then i will attach snapshot of book containing code and output The issue with book code is that , i get error for "nu" variable and matlab says "NI" is undefined(i have underlined NI in book snapshot with red paint pencil) , so i used "NL" in my code and "NL"=N*L ,but i am not getting output as book
My code is as follows
clc;clear all;close all;
conv_time = zeros(1,150); fft_time = zeros(1,150);
%
for L = 1:150
tc = 0; tf=0;
N = 2*L-1; nu = ceil(log10(N*L)/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; subplot(1,1,1);
plot(n(25:150),conv_time(25:150),n(25:150),fft_time(25:150))
My output/plot snapshot is follow
[![enter image description here][2]][2]
Following is book snapshot [2]: https://i.stack.imgur.com/1wPVM.jpg