bug in the function

1 Ansicht (letzte 30 Tage)
yonatan friedman
yonatan friedman am 14 Jan. 2021
Kommentiert: Cris LaPierre am 15 Jan. 2021
What do I need to write in f2 (u1, u2) so that I do not have the error :
Undefined function or variable 'ETA'.

Antworten (1)

Cris LaPierre
Cris LaPierre am 14 Jan. 2021
What is ETA?
You cannot use a variable you have not defined. Perhaps you think this variable is loaded by data.mat, but apparently not.
  7 Kommentare
Cris LaPierre
Cris LaPierre am 15 Jan. 2021
The problem is when your for loop counter is 7, the value of d in f4 is a single number. However, in computing ETA, you use d(end-1). Since there is only a single value, end-1=0, which causes the error that you see.
Cris LaPierre
Cris LaPierre am 15 Jan. 2021
These types of errors are difficult if not impossible to spot by just inspecting your code. The best way to track down the issue is to learn how to use the debugger.

Melden Sie sich an, um zu kommentieren.

Kategorien

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

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by