Discontinuity of the convolution integral using for loop

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.
where k is assumed to be just constant in this case.
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
calculation.pngcalculation2.png
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

Asked:

on 29 Jan 2020

Community Treasure Hunt

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

Start Hunting!