How to speed up convolution with a million data points
I am currently doing convolution using nested for loops, for 10^6 data points in each for loop. Are there ways to speed up the following code? Thanks in advance!
% n = 1e6;
% mzL = rand(1, n);
% gg = rand(1, n-1);
for c = 2:n
mzR_temp = 0;
for d = 1:(c-1)
mzR_temp = mzR_temp + gg(c-d) * mzL(d);
end
mzR_II(c) = mzR_temp;
endI am currently doing convolution using nested for loops, for 10^6 data points in each for loop. Are there ways to speed up the following code? Thanks in advance!
% n = 1e6;
% mzL = rand(1, n);
% gg = rand(1, n-1);
for c = 2:n
mzR_temp = 0;
for d = 1:(c-1)
mzR_temp = mzR_temp + gg(c-d) * mzL(d);
end
mzR_II(c) = mzR_temp;
end I am currently doing convolution using nested for loops, for 10^6 data points in each for loop. Are there ways to speed up the following code? Thanks in advance!
% n = 1e6;
% mzL = rand(1, n);
% gg = rand(1, n-1);
for c = 2:n
mzR_temp = 0;
for d = 1:(c-1)
mzR_temp = mzR_temp + gg(c-d) * mzL(d);
end
mzR_II(c) = mzR_temp;
end nested for loops, convolution, million data points MATLAB Answers — New Questions