フィルターのクリア

SimBiology sensitivity analysis - "Complex values cannot be converted to logicals"

3 ビュー (過去 30 日間)
T Abraham
T Abraham 2017 年 7 月 28 日
編集済み: T Abraham 2017 年 8 月 4 日
I have a PBPK model with the partition coefficients calculated using a mechanistic model. I have a MATLAB function that defines the partition coefficient as an initial assignment in the SimBiology model. This causes a problem when running a sensitivity analysis:
"Complex values cannot be converted to logicals"
Is there a way to overcome this or do I have to do a manual sensitivity analysis?

採用された回答

Arthur Goldsipe
Arthur Goldsipe 2017 年 7 月 29 日
編集済み: Arthur Goldsipe 2017 年 7 月 29 日
The short answer is that you either need to change your model to make it compatible with SimBiology's sensitivity analysis technique or manually calculate sensitivities. More details on that below.
As described here, SimBiology uses complex-step differentiation when calculating sensitivities. This technique is used because it is usually much more accurate than traditional finite differencing, as illustrated here. One limitation of this technique is that all the mathematical expression in the model need to be complex differentiable.
A commonly encountered function that is not complex differentiable is abs. But based on the error you're reporting, I suspect you're using relational operators like < or >, which also are not complex differentiable. However, you can make your model compatible with SimBiology's sensitivity analysis capabilities by replacing these functions with functions that give the same result for real inputs but are complex differentiable. This technique is described in a paper by Martins, Kroo, and Alonso.[1] You can look for the paper on Google Scholar for details, but the short answer is that they suggest replacing a relational expression like x > y with real(x) > real(y) and replacing abs(x) with abs(real(x)) + imag(x). If you can make such changes to your model, you should be able to use SimBiology's sensitivity analysis capabilities.
[1] Martins, J. R. R. A., Ilan M. Kroo, and Juan J. Alonso. "An automated method for sensitivity analysis using complex variables." AIAA paper 689 (2000): 2000.
  1 件のコメント
T Abraham
T Abraham 2017 年 8 月 4 日
編集済み: T Abraham 2017 年 8 月 4 日
Thanks a lot! It now works!

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 7 月 29 日
I would speculate that you have a comparison between two values, but one of the values has turned out to be complex. But possibly you have the equivalent of "if expression" with the implicit test "if expression ~= 0" but the expression turns out to be complex.
I am not sure what the debugging facilities available are, but I would recommend starting to trace back under the assumption that something become complex when you did not expect it to.
Sometimes expressions turn unexpected complex due to round-off error. For example if you have
sqrt(10*A - B)
and A is 1E45 and B is 1E44, then even though algebraically the two are the same, because of quantization and round-off, 10*A would be less than B, leading to sqrt() of a complex number.
  1 件のコメント
Arthur Goldsipe
Arthur Goldsipe 2017 年 7 月 29 日
I'll post a follow-up answer shortly, but the complex values are introduced by SimBioogy's sensitivity analysis and cannot be avoided when using this feature. You can find more details here.

サインインしてコメントする。

コミュニティ

その他の回答  SimBiology コミュニティ

カテゴリ

Help Center および File ExchangePerform Sensitivity Analysis についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by