필터 지우기
필터 지우기

nested for loop help

조회 수: 3 (최근 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에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by