numerical integration error
조회 수: 2 (최근 30일)
이전 댓글 표시
How come I get an error? What does this mean?
X = 0:1:100; Y = X^(-1/2)*exp(-0.5*(0.00009996^2/X+34.3713^2*X)); Z = trapz(X,Y)
??? Error using ==> mpower
Inputs must be a scalar and a square matrix.
How can I numerically integrate the function Y?
댓글 수: 0
채택된 답변
Sean de Wolski
2011년 3월 2일
You need a '.' before your '^', i.e:
Y = X.^(...)
댓글 수: 2
Pavol Namer
2014년 8월 5일
Hi I solving similar problem. I don't realy understand the second comment "And also for the / and * involving the vector X."
What is the righ equstion for Y = X^(-1/2)*exp(-0.5*(0.00009996^2/X+34.3713^2*X)) It is: Y = X.^(-1/2)*exp(-0.5*(0.00009996^2./X+34.3713^2.*X))
I try to type function
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/180066/image.jpeg)
and don't know how, because same error appers...
Thank you for your answer.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!