【问题标题】:solving equation containing chi-square probability求解包含卡方概率的方程
【发布时间】:2019-07-29 15:31:03
【问题描述】:

我想解这个方程并在 Matlab 中找到 'u'。

对于这个等式的左边,我们有chi2cdf(u, 2*Nr, 'upper') 但我无法使用它并出现错误。

syms x positive

eqn = chi2cdf (x,2,'upper');

我得到了这个错误:

Error using symengine

cannot prove 'x<0' literally. to test the statement mathematically, use isAlways.

我该如何解决这个问题?

【问题讨论】:

  • 你是想在给定 L 和 M 的情况下以数字方式求解 u,还是以符号方式求解?

标签: matlab equation chi-squared


【解决方案1】:
  • 请改用函数句柄x符号 仅在评估 功能
  • 评估时只需将范围设置为 [0, inf]sign 隐式设置为 positive
  • 使用fzero() 求解等于零的方程
  • fzero() 不允许无限绑定,inf 可以替换为 exp(709)
  • 为什么exp(709)?: exp(709) = finiteexp(710) = infinite

代码如下

% Assuming L, M
L = 0.1;
M = 2;

% Equation
f =@(x) chi2cdf (x,2,'upper')-L/M;

% solve 
sol = fzero(f, [0, exp(709)]);

解决方案

sol = 5.9915

【讨论】:

    猜你喜欢
    • 2016-10-07
    • 1970-01-01
    • 2010-10-22
    • 1970-01-01
    • 1970-01-01
    • 2023-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多