where is the mistake?

조회 수: 1 (최근 30일)
Amer Al-Maashani
Amer Al-Maashani 2021년 1월 18일
편집: Amer Al-Maashani 2021년 1월 18일
ezplot('int((x*x*normpdf(x,1,2)))',[-20 20 0 2])

채택된 답변

Walter Roberson
Walter Roberson 2021년 1월 18일
What is being integrated? What is the lower bound? What is the upper bound?
Your use of [-20 20 0 2] suggests that you are expecting to plot over two dimensions. As you have an integral, that would require three variables, with one of them being the variable of integration. Your expression only has one variable, and it would be used as the variable of integration if the integral worked, leaving you with two extra variables.
Remember that int() is strictly for symbolic integration.
syms x
f = int((x*x*normpdf(x,1,2)))
f = 
ezplot(f,[-20 20 0 2])
  댓글 수: 1
Amer Al-Maashani
Amer Al-Maashani 2021년 1월 18일
편집: Amer Al-Maashani 2021년 1월 18일
Have a look to the plot for that
>> syms x
>> f = int((x*x*normpdf(x,1,2)))
f =
(5629499534213120*2^(1/2)*pi^(1/2)*erf(2^(1/2)*(x/4 - 1/4)))/5644425081792261 - (4503599627370496*x*exp(- x^2/8 + x/4 - 1/8))/5644425081792261 - (4503599627370496*exp(- x^2/8 + x/4 - 1/8))/5644425081792261
>> ezplot(f,[-20 20])
I got it as it should be.
Thanks a lot

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by