The Siemens Community Catalyst program was co-created with our community to acknowledge technology leaders who consistently contribute to the Siemens Community. Nominations are accepted on a rolling basis.
配列の中で、もっとも目標に近い数値のインデックスを取得するには?
直接の機能はありませんが、次のように行うことができます。indexofmin() という配列の中の最小値を取得する機能をうまく活用します。
配列 a のなかで、もっとも 3 に近いインデックスを取得します。 { a= {1, 2, 3, 4, 5} } {a} こうすると a=3 のとき b=0 ですので、3 に近ければ近いほど、b は 0 に近いです。 { b = a-3 } {b} 単純な引き算だと、正だったり負だったりして、最小値としてとりずらいので、二乗して、必ず正の数にします。 3 に近いほど 正の0 に近くなります。 { c=b^2 } {c} 最小のインデックスを取ります。 {d=indexofmin(c)} {d} そのインデックスを他の配列に使うならこうなります。 { e = { 7,8,9,10,11}} {e} {e[d]}
コメントなしの状態の物を添付しておきます。
Join us for a Community Conversation where we'll discuss practical approaches to analyzing complex electromagnetic models using hybrid solver techniques. This session will provide a general overview of how different computational methods can be combined within a single simulation to address models containing varied…
Join us for a community conversation to explore how different modeling approaches in Simcenter PSIM can help engineers simulate power electronics systems while balancing accuracy, simulation speed, and design insight. What you'll learn: Power transistor modeling : Thermal and high fidelity models Protection component…