For Loop Question- Compensation
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a computational function like
output = function (sed_dep,sed_rho,sed_speed,bottom_rho,bottom_speed)
(1) I initially have these loops:
for sed_dep=9.5:.5:14.5
for sed_rho=1200:50:1500
for sed_speed=1540:5:1570
for bottom_rho=2200:50:2700
for bottom_speed=1750:20:1850
Then I try to extend my search bound to: ( This is my goal)
for sed_dep=9.5:.5:14.5
for sed_rho=1200:50:2000
for sed_speed=1540:5:1570
for bottom_rho=1500:50:2700
for bottom_speed=1750:20:1910
(2) But I made a mistake to do the following shorter loop instead:
for sed_dep=9.5:.5:14.5
for sed_rho=1550:50:2000
for sed_speed=1540:5:1570
for bottom_rho=1500:50:1950
for bottom_speed=1870:20:1910
What I am doing is very computational intense, what are the optimal loops I can add to achieve my goal without repeating the loop I have already done in (2)? Thanks!
댓글 수: 1
Adam Danz
2018년 8월 4일
Your question is unclear. Do you mean you've already done the loops in your 2nd block of code though you intended to do the loops in the 3rd block of code; and since the function consumes so much time you don't want to repeat the loops you've already done? That seems trivial.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!