Ok so this is what I have so far.


function [WaveAmplitude] = CreateCombinedWave(frequency,amplitude,phase,time)

for i = 1:length(frequency)
WaveAmplitude = amplitude(i) * sin(2*pi*frequency(i)*time + phase(i));
end


This function is ment to create a time doman representation of a combined wave form (the sum of several different sine waves). The user inputs a 1d array for frequency, amplitude and phase in my script, length of 1d arrays (except time) will be the same and is determined by how many waves they want. Time is how many values between 0:1 it gives.

The first element of each of the frequency, amplitude and phase arrays contains the
frequency, amplitude and phase values used to describe the first simple sine wave.
The second element in each of theses three arrays contains the values used to describe
the second simple sine wave and so on.

My question is how do I get the function to put the first set of WaveAmplitude values as the first row in a 2d array, second set in second row etc etc.

I think this is kinda simple but I been trying for hours.. Im really bad at matlab. I think I need to use i like maybe output(i)=WaveAmplitude or something but it doesnt work. Any help is greatly appreciated.