MATLAB POLYSPACE 7 Instalační příručka Strana 414

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 618
  • Tabulka s obsahem
  • ŘEŠENÍ PROBLÉMŮ
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 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
Zobrazit stránku 413
1 2 ... 409 410 411 412 413 414 415 416 417 418 419 ... 617 618

Komentáře k této Příručce

Žádné komentáře