Path: news.mathworks.com!not-for-mail
From: "payam " <payamvahdati@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: simple loop problem
Date: Thu, 20 Dec 2012 15:38:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 22
Message-ID: <kavbd0$ji8$1@newscl01ah.mathworks.com>
Reply-To: "payam " <payamvahdati@yahoo.com>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1356017888 20040 172.30.248.45 (20 Dec 2012 15:38:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 20 Dec 2012 15:38:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3203583
Xref: news.mathworks.com comp.soft-sys.matlab:785142

Hello all,
I put my code here so you can understand better what i am looking for. This is my code :

Lambda= 0.785;
k= 2*pi/Lambda;
S = 40;
a= 0.3;
l = 10;
theta0= atan (S/l);
n= (S/a) ;
s= theta/n ;
I0 = 100;

for i=1:4*n
    for j=1:n
        I(i,j) = I0 *(sin((k*a/2)*sin(theta0-(j-i)*0.58)))/(k*a/2)*sin(theta0-(j-i)*0.58) ;
        
    end
end

I want at the end to have data that contains : [ I(1,:), I(2,:), I(3,:), ..... , I(4n,:) ]
it means I want 4n numbers that are the sum up of all the js for each individual i.