Keep a for loop running when ODE gives an error
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
I am trying to run a code for sensitivity analysis on initial conditions and parameters of a process. To evaluate the different inputs I use a for loop and I solve an ODE in each iteration. The problem is that some of the combination of parameters and initial conditions cannot be solved and, when this happens, ode45 (and ode15s) stops the script. I really would wish that the for loop could keep on running after storing a warning output from the odesolver. Do you know if this is possible? I include a pseudocode of the script:
% mxn A matrix contaning m sampling combinations of n input parameters
for i=1:m
input=A(i,:)
solution(i)=odesolver(@function,t,input)
end
So the question is if I could do something so that the for loop keeps running even if the odesolver gives an error message. Thank you,
Miguel
댓글 수: 0
채택된 답변
Grzegorz Knor
2011년 9월 30일
% mxn A matrix contaning m sampling combinations of n input parameters
for i=1:m
input=A(i,:)
try
solution(i)=odesolver(@function,t,input)
catch ME
warning(...)
end
end
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!