How to build a matrix where each element is a vector

Hi all,
I’m looking for the best way to construct a matrix where each element is an actual vector.
More specifically, if I have:

fs = 10 # Sampling Frequnecy [Hz]
𝑓 = 1e-3 # Forcing frequency [Hz]
t_end = 10^4
t = collect(0.0:1/fs:t_end)
ϕ = [π/6, π/9, π/7.5, π/3]
a = [0.001, 0.003, 0.004]

I want to create a matrix where each element is a time-series:

Matrix[i,j] = @. sin(2*π*𝑓*t - ϕ[i]) + a[j]*t

I know this should be simple, but I can’t find the best way to do it for some reason.
In addition, is there a way to build this matrix dynamically with push! too?

Thank you!

[@. sin(2*π*𝑓*t - ϕ[i]) + a[j]*t for i in 1:4, j in 1:3]

would be one possibility (using comprehension, see Single- and multi-dimensional Arrays · The Julia Language )

One other way is:

julia> m = Matrix{Vector{Float64}}(undef, length(ϕ), length(a));

julia> for i in 1:4, j in 1:3
           m[i,j] = @. sin(2*π*𝑓*t - ϕ[i]) + a[j]*t
       end

BTW, don’t use collect here, there’s no point.

Also, a minor point, but consider using sinpi for stuff like this. It will be a bit more accurate and imo, cleaner.