Edited answer based on latest comments:
To avoid any for
loop, you can multiply your two vectors to obtain an array, then reshape the array to put all the values in line.
The way you are building t
, it will be of dimension [1xm] (with m=length(t)
)
For a csv
vector of dimension [1xn], instead of your loop, use:
%// generate an array size [nxm] by multiplying [nx1] * [1xm]
wave2 = csv.' * sin(two_pi_freq * t) ;
wave2 = reshape( wave2.' , [] , length(t)*length(csv) ) ; %// reshape the array in one [1xm*n] line
This should replace your last 4 lines of code (the first definition of wave
and the 3 lines of the loop.