nested for loop help

1 次查看(过去 30 天)
Christopher
Christopher 2013-7-14
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
The correct answer should be:
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

回答(1 个)

Christopher
Christopher 2013-7-14
Anyone?
  1 个评论
Jan
Jan 2013-7-14
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by