Index exceeds the number of array elements (11)

조회 수: 1 (최근 30일)
Michel Lopes Villaluz
Michel Lopes Villaluz 2020년 5월 25일
편집: Walter Roberson 2020년 5월 25일
Hi, how could i take it off the error?
  댓글 수: 1
Ruben Lange
Ruben Lange 2020년 5월 25일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Michel Lopes Villaluz
Michel Lopes Villaluz 2020년 5월 25일
Thanks!
I have another mistake but a don't know what it meens
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 5월 25일
편집: Walter Roberson 2020년 5월 25일
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])

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by