suggestion for the integrating the gaussian function
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Neels
el 27 de Jun. de 2011
Comentada: anu chauhan
el 12 de Jun. de 2016
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
3 comentarios
Respuesta aceptada
Daniel Shub
el 27 de Jun. de 2011
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.
3 comentarios
Daniel Shub
el 27 de Jun. de 2011
Your code is still not valid. The variable t is undefined and there is an extra "end" statement. The for loop also does not do anything, since you keep over writing bt. The function trapz is going to have problems since x is a scalar (equal to 16). Try simplifying your code by deleting everything that is not part of the problem. For example, I am guessing everything up to the for loop (and possibly the for loop) could be deleted and the definition of bt could be redefined without the variables Po, vroup, t0 and atten.
Más respuestas (0)
Ver también
Categorías
Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!