Hello, I am working on a basic signals problem:
I have values for w(omega), phi(phase shift), and k(amplitude) stored in 3 separate 2D arrays. Each array is 131 row x 15 columns. To create a cosine I start at (1,1) in each array and plug those values into the formula for a cosine. Then I take that cosine I just created and add it to the cosine created from (1,2), then (1,3) and so on until I have summed the cosines from all 15 columns in that row. Once the row is complete I move onto the next row and do (2,1), (2,2), (2,3).... until I reach column 15. Once I have the sums of the 131 rows, I would like to add them together to make one long wave. The sampling frequency(fs) is 44.1kHz so each of the 131 rows should be 50ms in length when played separately and the whole thing should be about 6.5 seconds.
Here is the code I have created so far:
clear
load('data1.mat');
k = 2*abs(A);
w = 2*pi*freqs;
phi = angle(A) ;
t = (1:2205)/fs;
wave = 0;
for x=1:131
for y = 1:15
wave = wave + k(x,y)*cos(w(x,y)*t + phi(x,y));
end
end
sound(wave);
This isn't happening so I'm seeking your input. Thank you for your time.