Discontinuity of the convolution integral using for loop
Show older comments
Hello, I am doing the calculation of convolution integral using the simple form indicated in Eq. 1) in the Ref. "Phys. Rev. Accel. Beams 3, 101302" (2000).
In the equation
is the Gaussian density distribution, and there is another cosine term.
Using the simple script, I made very similar plot compared to the figure in Ref (Fig. 2b). However, what I faced is that there is some unknown
discontinuities in the plot. I really do not know why this happens.
Here is the script I used for the simple calculation where w1, c_cgs, sigz are constant values.
Z0 = linspace(-0.8, 20, 30000);
for i = 1 : length(Z0)
f = @(X) (cos((wl/c_cgs).*(Z0(i) - X))).* exp(- (X.^2) / (2 * sigz^2));
fint(i) = integral(f, -inf, Z0(i));
end


This is the figure I plotted: it is not smoothly continuous. If you take a look at the scatter plot, there is some discontinuities.
I was wondering if there is some problems on my script. It could be very helpful if you let me know how to solve this issue...
Thanks a lot!
Best,
Seongyeol
Answers (0)
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!