MATLAB POLYSPACE 7 Guida di Installazione Pagina 414

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
Vedere la pagina 413
6 Editing and Debugging M-Files
Try out collatzplot to see if it w orks correctly. Use a simple input value,
for example, 3, and com pare the re sults to those sho wn in the preceding
table. Typing
collatzplot(3)
produces the plot shown in the following figure.
The plot for n = 1 appears to be correct—for 1, the C ollatz series is 1, and
contains one integer. B ut for
n =2andn = 3, it is w rong because there should
be only one value plotted for each integer, the number of integers in the
sequence, which the preceding table show s to be 2 (for
n =2)and8(forn
= 3). Instead, multiple values are plotted. Use MATLAB debugging features
to isolate the problem.
6-106
Vedere la pagina 413
1 2 ... 409 410 411 412 413 414 415 416 417 418 419 ... 617 618

Commenti su questo manuale

Nessun commento