怎么用matab找到​对某个概率密度函数从​0开始积分对应积分结​果为0.5的积分上限​,

假设这个函数为f,用代码说明

댓글 수: 1

Walter Roberson
Walter Roberson 2023년 5월 27일
Approximate translation:
How to use matab to find the upper limit of integration for a certain probability density function starting from 0, and the corresponding integral result is 0.5,
Assuming that this function is f, explain it with code

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2023년 5월 27일

0 개 추천

format long g
f = @(x) exp(x).^2 - sin(x); %example function
x0 = 0.8;
UB = fsolve(@(ub) integral(f, 0, ub) - 0.5, x0)
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
UB =
0.381241879389454
%check
integral(f, 0, UB)
ans =
0.500000173020638

댓글 수: 1

Yucheng
Yucheng 2023년 5월 29일
你好,我在使用fslove求解f-0.5=0的根的时候,发现x0的取值可能使方程找不到根,matlab给出下面的警告:最小步长大小已快达到 x = 7.99072e+21。可能具有奇异性,或者容差可能对于此问题太小。
请问怎么样让x0的取值不影响根的求解结果

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품

릴리스

R2019a

질문:

2023년 5월 27일

댓글:

2023년 5월 29일

Community Treasure Hunt

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

Start Hunting!