MATLAB: Suggestion for the integrating the gaussian function

integrationnumerical integrationsignal processing

Can someone help me with how to integrate the following Gaussian function over x whose range is [0 16]. The problem occurs when I try to shift the signal over time t which ranges t = (-1000:2:1000)*1e^-9 and t0 = 100e-12;
bt = 2*exp(-0.5*((t-((2*x)/(2e^8)))/t0).^2)*attn
I tried with quad and trapezoid. I am getting errors related to numerical integration. Any help is appreciated.
thanks

Best Answer

I don't really understand the question. Your Gaussian function seems to depend on two variables (t and x). The t makes me think you want a 1D Gaussian. For the parameters you have given your sample rate on t is not high enough. If you plot bt, you just get a spike. Of course your parameters could be off since "1e^-9" and 2e^8 are not valid MATLAB syntax.
Once you figure out what you are trying to integrate and get your parameters correct, I would suggest
doc normcdf
or
doc erf
to do the integration. I believe they are optimized for intgrating a Gaussian.
Related Question