MATLAB: Loop generation doubt.

differential equationsequationfor looplooploopsMATLABmatrixmatrix arraymultiplenumerical integrationsimulationwaveletwhile loop

Hi,
I need to create a loop. I have to do a numerical analysis of thousands of data points.
My equation is,
E=A*cos(k-(w*t))
I have A,k and w three of them have same length 1×10. In the case of t which i have 1×50.
what i have to do is i need to take the first value of A,k and w and vary t (means run with range of values) . I need to do the same processs for the rest of the rows of A,k and w and vary t.
To be more precise.
A k w T
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
N N N 5
6
N
the equation will be
First calculation need to be
E=1*cos(1-(1*(1….N)))
second
E=2*cos(2-(2*(1….N)))
…….
continue upto length of A,k,w

Best Answer

% DO NOT USE THESE. USE YOUR DATA. THESE ARE FOR AN EXAMPLE ONLY
T = rand(160547,1);
A = rand(44880,1);
k = rand(size(A));
w = rand(size(A));
%%%%%% Only use the code below %%%%%
% Preallocate memory for E
E = zeros(1,160547);
% Calculate E
for ii = 1:size(E2,2)
E(ii) = sum(A.*cos(k-(w.*T(ii))));
end