I am "time-stepping" an electromagnetic field at time instances per frequency
The EM field value at time-zero is a 3D matrix of dimensions [nvalues x 1 x nfrequencies] (see attached)
I want to create a 4D matrix where time is the 4th dimension and apply an algebraic equation across each dimension based on the value of the variables stored in arrays [frequency] and [time]
ie
size(EM_freq_time) = [nvalues x 1 x frequencies x time]
to attempt this i create a matrix of zeros
EM_freq_time = zeros(length(Ex), length(frequencies), length(t));
the equation i must apply is
EM_value(frequency,time,phase) = value*sin(2*pi.*frequencies.*t+Phase)
where frequency is a column vector size [nfreqs, 1]
time is a column vector size [nsteps, 1]
phase is a column vector size [nvalues]
how can i apply this equation using indexing?
Best Answer