# nested for loop help

3 views (last 30 days)
Christopher on 14 Jul 2013
I am writing a matlab code that uses the vortex lattice method to calculate lift and induced drag. I am hung up on calculating a nested for loop and was hoping I could get help. My code is shown below along with a rough guide on how to do it.
I have the nested for loop layed out, but I don't think it is correct and was hoping someone could help me to correct it.
Where:
qbv =
0 0 3.4300
0 0 3.4300
0 0 3.4300
0 0 3.4300
0 0 3.4300
0 0 3.4300
qlhs =
0 0 -1.2000
0 0 -1.2000
0 0 -1.2000
0 0 -1.2000
0 0 -1.2000
0 0 -1.2000
qrhs =
0 0 1.2000
0 0 1.2000
0 0 1.2000
0 0 1.2000
0 0 1.2000
0 0 1.2000
unv =
0 0 -1
0 0 -1
0 0 -1
0 0 -1
0 0 -1
0 0 -1
for i = 1:nlatall
for j = 1:nlatall
% IC matrix for the 3c/4 control points
qbv_term(i,:) = dot(qbv(i,:),unv(i,:));
qlhs_term(i,:) = dot(qlhs(i,:),unv(i,:));
qrhs_term(i,:) = dot(qrhs(i,:),unv(i,:));
F(i,j) = (1/(4*pi))*((qbv_term(i,:)-2*qlhs_term(i,:)+2*qrhs_term(i,:)));
Ft(i,j)=(1/(4*pi))*(-2*qlhs_term(i,:)+2*qrhs_term(i,:));
end
end
F =
0.5622 -0.0870 -0.0147 -0.0060 -0.0033 -0.0020
-0.0870 0.5622 -0.0870 -0.0147 -0.0060 -0.0033
-0.0147 -0.0870 0.5622 -0.0870 -0.0147 -0.0060
-0.0060 -0.0147 -0.0870 0.5622 -0.0870 -0.0147
-0.0033 -0.0060 -0.0147 -0.0870 0.5622 -0.0870
-0.0020 -0.0033 -0.0060 -0.0147 -0.0870 0.5622
Thanks

Christopher on 14 Jul 2013
Anyone?

#### 1 Comment

Jan on 14 Jul 2013
Please do not bump a question on a weekend after 11 hours. It looks too pushy. When the contributors in the forum do not know an answer or find the time to post it, it is counterproductive, if they read the question repeatedly. Therefore I think it is a friendly limit to post after a minimum of 24 hours only.