Simulink数值评估以防止溢出 [英] Simulink numerical evaluation to prevent overflow

查看:340
本文介绍了Simulink数值评估以防止溢出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个功能

f(a,b) = { 
            a*a/b   if a < b,
            b       if a >= b 
         }

为a和b的值(介于0和1之间,包括0和1)定义.

defined for values of a and b between 0 and 1 inclusive.

该函数在此范围内的a和b的所有有效值处都是连续的. (真的!自己尝试一下!)但是我不确定如何在Simulink中对其进行评估.问题是,我无法弄清楚如何以可以评估函数的两个"forks"并采用最小值或最大值(例如min(a*a,b*b)/b)的方式重述它,而不会出现零除错误. b=0,我想避免陷入有条件执行的子系统之类的问题.

The function is continuous at all valid values of a and b in this range. (Really! try it yourself!) But I'm not sure how to evaluate it in Simulink. The problem is that I can't figure out how to restate it in a way that I could evaluate both "forks" of the function and take the min or max (e.g. min(a*a,b*b)/b) without having a divide-by-zero error at b=0, and I'd like to avoid getting into things like conditionally-executed subsystems.

有人知道我该怎么做吗?

Does anyone know how I might go about doing this?

推荐答案

您有一些奇怪的约束.由于您坚持要评估两个分叉并取两者中的最小值,因此唯一的解决方案是不除以零,而是除以足够小的数字以避免出现错误(例如eps).

You have some strange constraints. Since you insist on evaluating both forks and taking the min of the two, the only solution is to not divide by zero but by a small enough number to avoid an error (eps for instance).

或if操作阻止:

这篇关于Simulink数值评估以防止溢出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆