Resolving errors with Raphson method
이전 댓글 표시
Hello,
I am having difficulties in writing a Raphson method using a while loop. Matlab keeps returning error: y(0): "subscripts must be either integers 1 to (2^63)-1 or logicals". I have tried to change my code several times, to try to solve this problem, but I have been unsuccesful. I am wondering if anyone has any suggestions on how to solve this problem?
댓글 수: 4
Star Strider
2023년 9월 17일
The problem is that it appears that you are using C syntax in MATLAB. That will not work. You probably need to re-write the entire file in valid MATLAB code.
That aside, in MATLAB, indexing begins at 1, not 0, and subscripts (indices) need to be integers greater than 0.
Alexander
2023년 9월 17일
Dyuman Joshi
2023년 9월 17일
You have to loop over the values [1 2 3 ... length(x)], right? If yes, why not use a for loop? Because you are not breaking out of the while loop if a condition is met.
Also, I don't understand why you are adding x(i) to i, in the last line of the while loop.
Alexander
2023년 9월 17일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
