Welcome! Thanks for the MWE, but for others to help please make sure it can be run:
-
SquarePulseis not defined - There is an unexpected
endin the calling code - For the array comprehension
Ω1you might have meanti = 1:5instead ofi = 5
My inital guess for the problem is that Ω1 is defined in the global. Try to const Ω1 = [... it.