필터 지우기
필터 지우기

How can I solve this problem in the matlab program ?

조회 수: 2 (최근 30일)
Vuqar Samedov
Vuqar Samedov 2020년 12월 21일
답변: Walter Roberson 2020년 12월 22일
  댓글 수: 3
Vuqar Samedov
Vuqar Samedov 2020년 12월 21일
Dear Walter Roberson, I use it in the matlab program, but the answer is not correct. I do not know why the answer is incorrect? The answer should actually be 1.
>> syms x a b
>> f=1/b*sqrt(2*pi)*exp(-1/2*b^2)*(x-a)^2;
>> u=(1/b*sqrt(2));
>> f=subs(f,u);
>> int (f,-inf,inf)
ans =
NaN
Timo Dietz
Timo Dietz 2020년 12월 21일
Some parenthesis are missing and u seems to be wrongly defined. Nevertheless, Matlab seems to calculate intemediate steps which prevents the final elimination of values on symbolic side.

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

채택된 답변

David Hill
David Hill 2020년 12월 21일
It does equal 1
syms u
int(exp(-u^2),-inf,inf);
  댓글 수: 1
Timo Dietz
Timo Dietz 2020년 12월 21일
Yes it does, but he substitution does not work as expected. Even with all parenthesis set and u defined correctly, Matlab seems to calculate intermediate values (e.g. sqrt(2)) and finally is not able to eliminate these.

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2020년 12월 22일
syms x a b u
Pi = sym(pi)
Pi = 
π
f = 1/(b*sqrt(2*Pi))*exp(-1/(2*b^2)*(x-a)^2)
f = 
U = (x-a)/(b*sqrt(2));
DU = diff(U,x);
B = solve(u == U, b)
B = 
fs = subs(f/DU, b, B)
fs = 
int(fs,-inf,inf)
ans = 
1

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by