For probability distribution i am getting this error.
이전 댓글 표시
I am diagonalizing Hamiltonian which is square matrix and i am getting eigen values like Ek =diag(D);
After then i have defined S = Ek+1- Ek and accordingly i have calculated X =S/mean(S), so now i am trying to calculate P(x) =(pi*x/2)*exp(-pi*x.^2/4), but in return i am getting error that attempted to access (0); index must be a positive integer.
Please let me know where i am doing mistake.
답변 (1개)
Hornett
2024년 4월 25일
0 개 추천
The error message you're encountering, "attempted to access (0); index must be a positive integer," typically occurs in MATLAB when you're trying to index into an array with an index of 0 or a negative number, or when using non-integer values as indices. However, based on the operations you've described (calculating S, X, and then P(x)), it doesn't seem like you're directly indexing arrays. Therefore, the error might be indirectly related to the operations you're performing or a different part of your code not shown in your question. x`
카테고리
도움말 센터 및 File Exchange에서 Triangular Distribution에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!