Effacer les filtres
Effacer les filtres

Calculating a convolution using conv vs. a loop

1 vue (au cours des 30 derniers jours)
Senaasa
Senaasa le 25 Juin 2013
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

Réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by