# Performing a convolution of two exponential functions in Matlab

조회 수: 32 (최근 30일)
Ram Stan 2015년 7월 15일
댓글: Ram Stan 2015년 12월 18일
I'm currently attempting to convolve two exponential(one gaussian) functions in order to create a convolved equation in Matlab that I can then use in the custom equation section of the Curve Fitting application to fit to a distribution in order to extract certain parameter values for multiple datasets. The convolve functions in Matlab that I have examined seem to only work when utilizing matrices and there doesn't seem to be a method to convolve symbolic functions. Since my understanding of advanced convolutions and the corresponding integrals that go along with it is weak, I'm concerned my initial attempt at convolving the two equations contains errors.
f(equation1) = a*exp((-x)/(b))+1
f(equation2) = (1/(4*pi*c^2))*exp((-x^2)/(4*c^2))
f(convolveattempt1) = (1/(4*sqrt(pi)*c)) + (a/(2*sqrt(pi)*c))*exp(((b*x-2*c^2)^2-(b^2)*(x^2))/(4*c^2*b^2))*(1-normcdf(((2*c^2-b*x)/(c*b*sqrt(2))),mu,sigma))
My first attempt at convolution (by hand) seems to return unexpected values for certain parameters (namely c) when I fit it to the distributions. I'm wondering if there is a method to let Matlab perform the convolution and allow me to fit my dataset (preferably in the curve fitting function where I can adjust parameter limits and bounds) without having to rely on my math and parenthetical placement.
Any help would be greatly appreciated.
##### 댓글 수: 4이전 댓글 2개 표시이전 댓글 2개 숨기기
Image Analyst 2015년 7월 16일
I don't think with just equation 1 and equation 3 you can figure out what a, b, and c should be. I mean, they could be anything.
Ram Stan 2015년 7월 16일
That's not an issue, I can extract (a b c) from curve fitting any of the equations. I'm attempting to figure out if there is a method of performing a symbolic function convolution in Matlab since I have suspicions that my convolution attempt by hand has errors in it.

댓글을 달려면 로그인하십시오.

### 채택된 답변

Ghada Saleh 2015년 7월 17일
Hi Ram,
You can use the int function in the Symbolic Math Toolbox. This function does not always give a closed form solution but in my knowledge, this is the only function that can perform symbolic convolution. In your case, you can execute the following code:
>> syms x a b c t;
>> f1 = a*exp((-x)/(b))+1;
>> f2 = (1/(4*pi*c^2))*exp((-x^2)/(4*c^2));
>> f2_c = (1/(4*pi*c^2))*exp((-(t-x)^2)/(4*c^2)); %f2_c = f2(t-x)
>> result = int(f1*f2_c,t,-inf,inf);
I hope this helps,
Ghada
##### 댓글 수: 1이전 댓글 -1개 표시이전 댓글 -1개 숨기기
Ram Stan 2015년 12월 18일
Hello Ghada,
I appreciate the response, it seems like this particular equation fits with similar fitted parameters as the derived equation I was using before. To me it looks like the proper convolution as near as I can tell.
Thank you,
Ram

댓글을 달려면 로그인하십시오.

### 추가 답변 (1개)

Torsten 2015년 7월 17일
##### 댓글 수: 1이전 댓글 -1개 표시이전 댓글 -1개 숨기기
Ram Stan 2015년 12월 18일
Hello Torsten,
This isn't quite the answer I was looking for, I attempted the wolphram alpha convolution prior to even submitting my question here, but the format and corresponding answer wolphram gives doesn't provide a usable/fittable equation (at least as far as matlab goes). From what I can tell, the wolphram answer doesn't fully convolve the two equations into a separate equation, instead leaving some abstract functions that can't be parsed in Matlab to fit a curve.
Thanks,
Ram

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Exponential Distribution에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by