Index exceeds the number of array elements (11)

1 Ansicht (letzte 30 Tage)
Michel Lopes Villaluz
Michel Lopes Villaluz am 25 Mai 2020
Bearbeitet: Walter Roberson am 25 Mai 2020
Hi, how could i take it off the error?
  1 Kommentar
Ruben Lange
Ruben Lange am 25 Mai 2020
Hello,
It seems that you tried to use entry 11 of your vector x. In line 4 however, you stated that x would be a vector of length 10 with values ranging from 0 to 1. In your for loop you let i cycle from 1 to 20, so as soon as i reaches 11, it can't find a value in x as x only reaches to 10 entries.
Hope that helps.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Michel Lopes Villaluz
Michel Lopes Villaluz am 25 Mai 2020
Thanks!
I have another mistake but a don't know what it meens
  1 Kommentar
Walter Roberson
Walter Roberson am 25 Mai 2020
Bearbeitet: Walter Roberson am 25 Mai 2020
You need explicit multiplication between the 2 and the x.
Also as we discuss in your other posting, you need to use exp()
fplot('-exp(-x)+x.^2-2*x+2',[0 1])

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by