Current location - Training Enrollment Network - Mathematics courses - How does end in matlab work? The main reason is that the following code is incomprehensible.
How does end in matlab work? The main reason is that the following code is incomprehensible.
End stands for the last element subscript of the matrix. Tru(end+ 1) dynamically expands the number of elements of tru.

End means the last element subscript of the matrix, for example:

& gt& gta=randn( 1,3)

a =

- 1.3077 -0.4336 0.3426

& gt& gt Answer (End)

ans =

0.3426

& gt& gta=randn(3,3)

a =

3.5784 3.0349 0.7 147

2.7694 0.7254 -0.2050

- 1.3499 -0.063 1 -0. 124 1

& gt& gt Answer (End)

ans =

-0. 124 1

Randn randomly generates a number.

ht=plot(tru,' g-'); Drawing design

Hang in there, keep the original picture and keep drawing.