Integrating: I keep getting 'Array indices must be positive integers or logical values.'
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Patrick Myers
am 24 Mär. 2020
Beantwortet: Steven Lord
am 24 Mär. 2020
I keep getting the error in the title followed by a bunch of errors in the integration functions itself. I don't know why this keeps happening. What is wrong with it? I have a suspicion it has to do with shadowing so if you test the code and it works please tell me the answer because I don't know how to fix shadowing.
Thanks
Akzeptierte Antwort
Star Strider
am 24 Mär. 2020
Vectorise the square in the first term (replace ^2 with .^2) and the errors will likely go away.
(My version of MATLAB will not run images of code, only code itself.).
0 Kommentare
Weitere Antworten (1)
Steven Lord
am 24 Mär. 2020
You have y(1+x.^2) inside the second term of Fun. That is an attempt to index into y, but you probably intended it to be y times (1+x.^2).
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!