Calculating a convolution using conv vs. a loop

Hi,
I'm currently calculating the convolution of a Gaussian and a power law using the following code snippet:
for j=1:1:size(Axis_Tw,1)
t = Axis_Tw(j);
if Axis_Tw(j) <= 100
temp = 0;
CPara = 0;
for i=1:1:nt+1
CPara = CPara + Gas(temp,Gparams)*PowerLaw(t-temp,Eparams)*dt;
temp = temp + dt;
end
FPara(j) = CPara;
else
FPara(j) = PowerLaw(t,Eparams);
end
end
I'm trying to use conv to do this instead of a loop. I'm confused on how to do this. Can conv take functions as arguments or can I only use vectors? I've tried evaluating Gas and PowerLaw for Axis_Tw and then passing those arrays into conv, but the result is very different (as in several hundred orders of magnitude).
Thanks, Charles

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

提问:

2013-6-25

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by